This is an automated email from the ASF dual-hosted git repository.

manuelbeck pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/cordova-plugin-network-information.git


The following commit(s) were added to refs/heads/master by this push:
     new d88517d  ios: add 5G check (#159)
d88517d is described below

commit d88517dc933e55262ec7e3bebe174f8209a8bc37
Author: Nagib Bin Azad <[email protected]>
AuthorDate: Tue Mar 31 18:06:04 2026 +0600

    ios: add 5G check (#159)
    
    Co-authored-by: Manuel Beck <[email protected]>
---
 README.md               | 2 ++
 src/ios/CDVConnection.m | 8 ++++++++
 types/index.d.ts        | 2 ++
 www/Connection.js       | 1 +
 4 files changed, 13 insertions(+)

diff --git a/README.md b/README.md
index d8e9131..3c693d4 100644
--- a/README.md
+++ b/README.md
@@ -62,6 +62,7 @@ wifi connection, and whether the device has an internet 
connection.
 - Connection.CELL_2G
 - Connection.CELL_3G
 - Connection.CELL_4G
+- Connection.CELL_5G
 - Connection.CELL
 - Connection.NONE
 
@@ -83,6 +84,7 @@ function checkConnection() {
     states[Connection.CELL_2G]  = 'Cell 2G connection';
     states[Connection.CELL_3G]  = 'Cell 3G connection';
     states[Connection.CELL_4G]  = 'Cell 4G connection';
+    states[Connection.CELL_5G]  = 'Cell 5G connection';
     states[Connection.CELL]     = 'Cell generic connection';
     states[Connection.NONE]     = 'No network connection';
 
diff --git a/src/ios/CDVConnection.m b/src/ios/CDVConnection.m
index 0d172be..1a52d14 100644
--- a/src/ios/CDVConnection.m
+++ b/src/ios/CDVConnection.m
@@ -83,6 +83,13 @@
                         return @"3g";
                     } else if ([telephonyInfo.currentRadioAccessTechnology  
isEqualToString:CTRadioAccessTechnologyLTE]) {
                         return @"4g";
+                        // 5G available since iOS 14.1
+                    } else if (@available(iOS 14.1, *)) {
+                        if ([telephonyInfo.currentRadioAccessTechnology 
isEqualToString:CTRadioAccessTechnologyNRNSA]) {
+                            return @"5g";
+                        } else if ([telephonyInfo.currentRadioAccessTechnology 
isEqualToString:CTRadioAccessTechnologyNR]) {
+                            return @"5g";
+                        }
                     }
                 }
                 return @"cellular";
@@ -107,6 +114,7 @@
     return [theConnectionType isEqualToString:@"2g"] ||
            [theConnectionType isEqualToString:@"3g"] ||
            [theConnectionType isEqualToString:@"4g"] ||
+           [theConnectionType isEqualToString:@"5g"] ||
            [theConnectionType isEqualToString:@"cellular"];
 }
 
diff --git a/types/index.d.ts b/types/index.d.ts
index 60b6c26..77e68b6 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -42,6 +42,7 @@ interface Connection {
      *     Connection.CELL_2G
      *     Connection.CELL_3G
      *     Connection.CELL_4G
+     *     Connection.CELL_5G
      *     Connection.CELL
      *     Connection.NONE
      */
@@ -57,6 +58,7 @@ declare var Connection: {
     CELL_2G: string;
     CELL_3G: string;
     CELL_4G: string;
+    CELL_5G: string;
     CELL: string;
     NONE: string;
 }
\ No newline at end of file
diff --git a/www/Connection.js b/www/Connection.js
index dd184b4..cd4cefa 100644
--- a/www/Connection.js
+++ b/www/Connection.js
@@ -27,6 +27,7 @@ module.exports = {
     CELL_2G: '2g',
     CELL_3G: '3g',
     CELL_4G: '4g',
+    CELL_5G: '5g',
     CELL: 'cellular',
     NONE: 'none'
 };


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to