Zfinix / carrier_info

📱 Carrier Info gets networkType, networkGeneration, mobileCountryCode, mobileCountryCode, e.t.c from both android and iOS devices.
MIT License
34 stars 48 forks source link

Throwing error and returning null on Mobile phone wihtout SimCard injected #33

Open AymenXD opened 1 year ago

AymenXD commented 1 year ago

When Trying on a phone where there is no sim card injected, the package throws this error :

PlatformException(no_carrier_name, No carrier name, java.lang.StringIndexOutOfBoundsException: length=0; index=3, null)

onghuisheng commented 1 year ago

will take a look this week, may I know which commit are you using?

AymenXD commented 1 year ago

I am using the latest commit of version 2.0.8 . Anyways good job on the plugin, You did a great one !!!!! Keep up the good work.

onghuisheng commented 1 year ago

can you try replacing this line in pubspec. yaml

  carrier_info: 2.0.8

with these 2 lines:

  carrier_info: 
     git: https://github.com/Zfinix/carrier_info.git

and see if it works?

AymenXD commented 1 year ago

Still the same problem unfortunately :/ You can reproduce this error by simply removing all the Sim Cards from your Android phone and then running the plugin example.

onghuisheng commented 1 year ago

Still the same problem unfortunately :/ You can reproduce this error by simply removing all the Sim Cards from your Android phone and then running the plugin example.

I'm unable to repro this issue even when using a device with no sim card inserted.

Did you ran flutter pub get or flutter pub upgrade after changing pubspec.yaml to this?

  carrier_info: 
     git: https://github.com/Zfinix/carrier_info.git

Also, may I know which Android version that you're using?

alfaruqrizqi18 commented 1 year ago

facing same issue

alfaruqrizqi18 commented 1 year ago

Still the same problem unfortunately :/ You can reproduce this error by simply removing all the Sim Cards from your Android phone and then running the plugin example.

I'm unable to repro this issue even when using a device with no sim card inserted.

Did you ran flutter pub get or flutter pub upgrade after changing pubspec.yaml to this?

  carrier_info: 
     git: https://github.com/Zfinix/carrier_info.git

Also, may I know which Android version that you're using?

Try this solution