react-native-sim-data icon indicating copy to clipboard operation
react-native-sim-data copied to clipboard

app forcefully closed with this error on os version < 21

Open karan101292 opened this issue 6 years ago • 3 comments

app forcefully closed with this error on os version < 21

com.facebook.react.common.JavascriptException: C++ Exception in 'NativeModules': java.lang.NoSuchMethodError: android.telephony.TelephonyManager.getPhoneCount

react native - v44

karan101292 avatar Sep 19 '17 10:09 karan101292

although TelephonyManager is available since API 1, that call doesn't exists in the current code. try doing a cd android && ./gradlew clean and unlinking and re-linking the library

SubscriptionManager on the other hand need at least API 22 level

pocesar avatar Sep 19 '17 10:09 pocesar

Yes SubscriptionManager needs API 22. so in that case, this module will not work in phones with API less than 22. or is there any workaround?

karan101292 avatar Sep 19 '17 11:09 karan101292

you can use TelephonyManager.getLine1Number but the person needs to have set his own number on the phone in "phone identity" and most people don't

best (sure) way is to ask the person for his number then read from SMS

pocesar avatar Sep 19 '17 16:09 pocesar