android
How to getSimOperator in dual SIM phone android?
I am building an android application where I need a value of "getSimOperator". I am able to get this value > 21 API version but for the lower version in dual SIM. I am getting a value of SIM1 but not able to get SIM2 value. How can I get "getSimOperator" value of SIM2 < 21 API version. I earlier posted a question below is the link How to get Mcc and Mnc below LOLLIPOP_MR1. Someone has referred me a link dual sim android phone which sim receive a call. But I am getting an error while implementing the code of above link. I had listed down the error "java.lang.NoSuchMethodException: getDefault [int]" Cloud anyone explains me why this error is coming.
here this link will might help you and refer the example no. 24 in this example http://www.programcreek.com/java-api-examples/android.telephony.TelephonyManager Try this Github link. https://github.com/illarionov/MozStumbler/blob/develop/src/org/mozilla/mozstumbler/cellscanner/GeminiCellScanner.java In this following method return all info for available simcard. private List<CellInfo> getCellInfo(int presentSimNumsIndex){} Another method is also which is as below. For API >=17: TelephonyManager manager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); // Get information about all radio modules on device board // and check what you need by calling #getCellIdentity. final List<CellInfo> allCellInfo = manager.getAllCellInfo(); for (CellInfo cellInfo : allCellInfo) { if (cellInfo instanceof CellInfoGsm) { CellIdentityGsm cellIdentity = ((CellInfoGsm) cellInfo).getCellIdentity(); //TODO Use cellIdentity to check MCC/MNC code, for instance. } else if (cellInfo instanceof CellInfoWcdma) { CellIdentityWcdma cellIdentity = ((CellInfoWcdma) cellInfo).getCellIdentity(); } else if (cellInfo instanceof CellInfoLte) { CellIdentityLte cellIdentity = ((CellInfoLte) cellInfo).getCellIdentity(); } else if (cellInfo instanceof CellInfoCdma) { CellIdentityCdma cellIdentity = ((CellInfoCdma) cellInfo).getCellIdentity(); } } In AndroidManifest add permission: <manifest xmlns:android="http://schemas.android.com/apk/res/android" <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> </manifest> To get network operator you can check mcc and mnc codes: https://en.wikipedia.org/wiki/Mobile_country_code https://clients.txtnation.com/hc/en-us/articles/218719768-MCCMNC-mobile-country-code-and-mobile-network-code-list-
Related Links
dlopen .so library with jni,ndk in android project
SocketIO exception while using Android client for socketIO
How to create an Overflow menu and combine it with an option menu ? “android”
changing the button background color based upon the button text value in android
Clearing previously entered edittext data automatically on checking a checkbox
How to implement HDP profile for Bluetooth stack with TI?
GooglePlayServicesUtil error dialog button does nothing
Use file:/// command to index files in an android web browser
Listen to when Android/GoogleTV is disconnected from a WAN
How to run an Android TTS in an IntentService
setImageBitmap on onPostExecute freeze my listview
View null pointer exception
Android values-sw600dp is not working in emulator
How to change the anchor point for drawable when drawing on google map in android?
Is it possible to execute a shell script in an Android phone?
Android: How to use audiotrack to make metronome?