Android dual SIM card API
You can use MultiSim
library to get details from multi-sim devices.
Available info from each sim card: IMEI, IMSI, SIM Serial Number, SIM State, SIM operator code, SIM operator name, SIM country iso, network operator code, network operator name, network operator iso, network type, roaming status.
Just add the lines below in your app-level Gradle script:
dependencies {
compile 'com.kirianov.multisim:multisim:2.0@aar'
}
Don't forget add required permission in AndroidManifest.xml:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
Use similar code in your code:
MultiSimTelephonyManager multiSimTelephonyManager = new MultiSimTelephonyManager(this);
// or
MultiSimTelephonyManager multiSimTelephonyManager = new MultiSimTelephonyManager(this, new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
updateInfo();
}
});
public void updateInfo() {
// for update UI
runOnUiThread(new Runnable() {
@Override
public void run() {
multiSimTelephonyManager.update();
useInfo();
}
}
// for update background information
multiSimTelephonyManager.update();
useInfo();
}
public void useInfo() {
// get number of slots:
if (multiSimTelephonyManager != null) {
multiSimTelephonyManager.sizeSlots();
}
// get info from each slot:
if (multiSimTelephonyManager != null) {
for(int i = 0; i < multiSimTelephonyManager.sizeSlots(); i++) {
multiSimTelephonyManager.getSlot(i).getImei();
multiSimTelephonyManager.getSlot(i).getImsi();
multiSimTelephonyManager.getSlot(i).getSimSerialNumber();
multiSimTelephonyManager.getSlot(i).getSimState();
multiSimTelephonyManager.getSlot(i).getSimOperator();
multiSimTelephonyManager.getSlot(i).getSimOperatorName();
multiSimTelephonyManager.getSlot(i).getSimCountryIso();
multiSimTelephonyManager.getSlot(i).getNetworkOperator();
multiSimTelephonyManager.getSlot(i).getNetworkOperatorName();
multiSimTelephonyManager.getSlot(i).getNetworkCountryIso();
multiSimTelephonyManager.getSlot(i).getNetworkType();
multiSimTelephonyManager.getSlot(i).isNetworkRoaming();
}
}
}
// or for devices above android 6.0
MultiSimTelephonyManager multiSimTelephonyManager = new MultiSimTelephonyManager(MyActivity.this, broadcastReceiverChange);
Usage:
// get info about slot 'i' by methods:
multiSimTelephonyManager.getSlot(i).
Force update info:
// force update phone info (needed on devices above android 6.0 after confirm permissions request)
multiSimTelephonyManager.update();
Handle of permissions request (6.0+):
// in YourActivity for update info after confirm permissions request on devices above android 6.0
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (multiSimTelephonyManager != null) {
multiSimTelephonyManager.update();
}
}
dual sim android sdk
As of Android 5.1 Multiple-Sim Support has been officially added to the Android SDK!
You can access information about the current used sim through the SubscriptionManager class.
Detect the status of two SIM cards in a dual-SIM Android phone
Android does not support multiple SIMs, at least from the SDK. Device manufacturers who have created multi-SIM devices are doing so on their own. You are welcome to contact your device manufacturer and see if they have an SDK add-on or something that allows you to access the second SIM.
Edit: (15th July, 2015)
Since API 22, you can check for multiple SIMs using SubscriptionManager
's method getActiveSubscriptionInfoList()
. More details on Android Docs.
Dual SIM card Android
The current Android platform does not have support for multiple SIMs. A device with such support has been customized for this, so you will need to get information from that device's manufacturer for any facilities they have to interact with it.
Related Topics
How to Detect Device Is Android Phone or Android Tablet
How to Open a PDF via Intent from Sd Card
Which Correct Flag of Autoconnect in Connectgatt of Ble
How to Have Searched Characters Colored When We Use Searchview in Recyclerview
Android: What Is Android.R.Id.Content Used For
Passing Argument to Dialogfragment
Android Studio Not Deploying Changes to App
Android: How to Remove Margin/Padding in Preference Screen
Removing a Fragment from the Back Stack
Android Broadcast Receiver for Sent Sms Messages
Device Not Detected in Eclipse When Connected with Usb Cable
Need an Example About Recyclerview.Adapter.Notifyitemchanged(Int Position, Object Payload)
Android:Call Activity of Another Application
Complete Working Sample of the Gmail Three-Fragment Animation Scenario
How to Get an Uri of an Image Resource in Android