I am using TelephonyManager
to get sim's serial number, but I want to get serial number of both the sims if the device is dual sim. I know I can do this using this answer but that method is too complex. So the question is that is there any simpler method? My device's Android Version is KitKat (API-19).
Asked
Active
Viewed 1,620 times
-1

Community
- 1
- 1

Raees Khan
- 371
- 1
- 5
- 20
-
Just copy past the whole class and use it. – Anis LOUNIS aka AnixPasBesoin Feb 04 '17 at 22:04
-
@AnixPasBesoin Can you please tell how can I get Serial Number of both the sims using that example? – Raees Khan Feb 04 '17 at 22:16
1 Answers
1
Since you're asking for help, I'll reformulate what's in this answer.
- Create a new
class
public final class TelephonyInfo
. - Copy/Past the code found in this answer.
- Get an instance of the
TelephonyInfo class
and use it.
How to get an instance?
// From an Activity, a Service...
TelephonyInfo telephonyInfo = TelephonyInfo.getInstance(this);
How to get both IMSIs?
// Check if the phone supports two SIM cards
if (telephonyInfo.isDualSIM()) {
// Check if the first SIM is ready
if (telephonyInfo.isSIM1Ready()) {
String imsiSIM1 = telephonyInfo.getImsiSIM1();
}
// Check if the second SIM is ready
if (telephonyInfo.isSIM2Ready()) {
String imsiSIM2 = telephonyInfo.getImsiSIM2();
}
}
Check the original answer, It's pretty well written.

Anis LOUNIS aka AnixPasBesoin
- 4,765
- 5
- 32
- 61