I'm using Ionic 5 and I want to get a real device phone number
Actual behaviour
I'm getting an error when trying to retrieve sim data
E/PluginManager: Uncaught exception from plugin
java.lang.SecurityException: getDataNetworkTypeForSubscriber
at android.os.Parcel.createExceptionOrNull(Parcel.java:2437)
at android.os.Parcel.createException(Parcel.java:2421)
at android.os.Parcel.readException(Parcel.java:2404)
at android.os.Parcel.readException(Parcel.java:2346)
at com.android.internal.telephony.ITelephony$Stub$Proxy.getNetworkTypeForSubscriber(ITelephony.java:9300)
at android.telephony.TelephonyManager.getNetworkType(TelephonyManager.java:3550)
at android.telephony.TelephonyManager.getNetworkType(TelephonyManager.java:3514)
at com.pbakondy.Sim.execute(Sim.java:157)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
at com.getcapacitor.MessageHandler.callCordovaPluginMethod(MessageHandler.java:123)
at com.getcapacitor.MessageHandler.postMessage(MessageHandler.java:61)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:335)
at android.os.Looper.loopOnce(Looper.java:186)
at android.os.Looper.loop(Looper.java:313)
at android.os.HandlerThread.run(HandlerThread.java:67)
Expected behaviour
I'm using Ionic 5 and I want to get a real device phone number
Actual behaviour
I'm getting an error when trying to retrieve sim data
E/PluginManager: Uncaught exception from plugin java.lang.SecurityException: getDataNetworkTypeForSubscriber at android.os.Parcel.createExceptionOrNull(Parcel.java:2437) at android.os.Parcel.createException(Parcel.java:2421) at android.os.Parcel.readException(Parcel.java:2404) at android.os.Parcel.readException(Parcel.java:2346) at com.android.internal.telephony.ITelephony$Stub$Proxy.getNetworkTypeForSubscriber(ITelephony.java:9300) at android.telephony.TelephonyManager.getNetworkType(TelephonyManager.java:3550) at android.telephony.TelephonyManager.getNetworkType(TelephonyManager.java:3514) at com.pbakondy.Sim.execute(Sim.java:157) at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98) at org.apache.cordova.PluginManager.exec(PluginManager.java:132) at com.getcapacitor.MessageHandler.callCordovaPluginMethod(MessageHandler.java:123) at com.getcapacitor.MessageHandler.postMessage(MessageHandler.java:61) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:335) at android.os.Looper.loopOnce(Looper.java:186) at android.os.Looper.loop(Looper.java:313) at android.os.HandlerThread.run(HandlerThread.java:67)
I am using
Hardware models
Example: Samsung G980F (API 31)
To reproduce you can use https://github.com/AndrewBargan/cordova-plugin-sim-problem
To install on an real device use the following commands
Look for error in Chrome console attached to the device or in the Android Studio Logcat console