cordova-plugin-network-information icon indicating copy to clipboard operation
cordova-plugin-network-information copied to clipboard

feat(android, ios): add 5G support

Open ZumelzuR opened this issue 3 years ago • 17 comments

Platforms affected

Motivation and Context

  Solve 5g detections for iOS and Android (the current state of the plugin classify as UKNOWN the 5g network)
 open issue -> https://github.com/apache/cordova-plugin-network-information/issues/125

closes #125

Description

 We added a a new listener for check if NR is available and using that, if is the case, detect the 5g.

Testing

    We tested on android simulator and a physical android 10 and iOS simulator

Checklist

  • [ x ] I've run the tests to see all new and existing tests pass
  • [ x] I added automated test coverage as appropriate for this change
  • [x ] Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • [ x] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • [x ] I've updated the documentation if necessary

ZumelzuR avatar May 13 '21 08:05 ZumelzuR

How do we get pull requests to get merged in master branch?

dev-jcb avatar Jul 07 '21 03:07 dev-jcb

Any news about when to release this fix

almothafar avatar Sep 15 '21 14:09 almothafar

Thank, these days are a little problematic for me but I will check and resolve all as soon as possible

ZumelzuR avatar Oct 26 '21 16:10 ZumelzuR

Sorry was impossible to me to do this changes before. I update all as you requested and tested in my local. If you have more feedback or changes to me add let me know

ZumelzuR avatar Apr 07 '22 14:04 ZumelzuR

You are right. Sorry I didn't realized about the changes on the package-lock.json. I will do the revert now

ZumelzuR avatar Apr 08 '22 08:04 ZumelzuR

what about this?

ZumelzuR avatar May 10 '22 10:05 ZumelzuR

@ZumelzuR On my iPhone 13 Pro networkInfo.currentRadioAccessTechnology is always nil. Strange enough another phone (with the same os version) this pointer is not nil. I found networkInfo.currentRadioAccessTechnology is deprecated and can be nil on ios >= 14.2. I`ve found this fix https://github.com/Tencent/Hippy/pull/1597/files. May you can try this and add this to your PR.

Edit: May you will use a more reactive form (with a nil check):

static NSString *radioAccessNameIn(CTTelephonyNetworkInfo *networkInfo) {
  if (@available(iOS 13.0, *)) {
    if (networkInfo.currentRadioAccessTechnology == nil && networkInfo.dataServiceIdentifier) {
        return [networkInfo.serviceCurrentRadioAccessTechnology objectForKey:networkInfo.dataServiceIdentifier]; 
    }
  }
  return networkInfo.currentRadioAccessTechnology;
}

DavidWiesner avatar Jun 15 '22 04:06 DavidWiesner

@ZumelzuR On my iPhone 13 Pro networkInfo.currentRadioAccessTechnology is always nil. Strange enough another phone (with the same os version) this pointer is not nil. I found networkInfo.currentRadioAccessTechnology is deprecated and can be nil on ios >= 14.2. I`ve found this fix https://github.com/Tencent/Hippy/pull/1597/files. May you can try this and add this to your PR.

Edit: May you will use a more reactive form (with a nil check):

static NSString *radioAccessNameIn(CTTelephonyNetworkInfo *networkInfo) {
  if (@available(iOS 13.0, *)) {
    if (networkInfo.currentRadioAccessTechnology == nil && networkInfo.dataServiceIdentifier) {
        return [networkInfo.serviceCurrentRadioAccessTechnology objectForKey:networkInfo.dataServiceIdentifier]; 
    }
  }
  return networkInfo.currentRadioAccessTechnology;
}

Thank you, ok yes I will do some testing on my devices and come back with the fix and an update.

ZumelzuR avatar Jun 15 '22 08:06 ZumelzuR

Done, I added the fixes at https://github.com/apache/cordova-plugin-network-information/pull/130/commits/b65a78315c6ed5e309fc639a2c02f9069d49505e

ZumelzuR avatar Jun 16 '22 12:06 ZumelzuR

I got an error

network-information/CDVConnection.m:63:94: expected ';' at end of declaration

DavidWiesner avatar Jun 16 '22 15:06 DavidWiesner

I got an error

network-information/CDVConnection.m:63:94: expected ';' at end of declaration

Sorry I forgot this, I added in the plugins folder but not here, I already add the fix commit.

ZumelzuR avatar Jun 16 '22 20:06 ZumelzuR

@ZumelzuR I see IOS Test suites are failing for this PR

mdivya-symplr avatar Oct 03 '22 11:10 mdivya-symplr

For fix this I should try to simulate a 5g connection in a ios12 device and check if is working?

ZumelzuR avatar Oct 05 '22 08:10 ZumelzuR

@breautek I review the commits and add the changes of @erisu

thanks

ZumelzuR avatar Oct 25 '22 17:10 ZumelzuR

some update on this?

ZumelzuR avatar Nov 03 '22 18:11 ZumelzuR

Can somebody run the test or merge finally this? @erisu @breautek

ZumelzuR avatar Nov 18 '22 14:11 ZumelzuR

closed/re-opened the PR as the test results expired and wasn't available. Assuming that the tests passes I'll do one last row call and I'll merge if there are no objections in the next ~24 hours.

breautek avatar Dec 16 '22 20:12 breautek