Android : telefon çift SIM olup olmadığını Kontrol edin
Sonra bir sürü araştırma forumlar, bunu biliyorum artık yok yol bulmak için IMSI veya SIM seri numarası için her iki SIM kartları bir çift SIM telefon (hariç irtibata üretici). Şimdi değişti benim sorum, telefonu iki SİMs sahip olduğunu tespit edebilir miyiz? Bazı istihbarat ile tespit edilebilir inanıyorum. Birkaç düşünemiyorum yolu vardır:
USSD kodu arama ve IMEI numarası için günlükleri izleme (bu denedim *139# Hindistan. İşe yaradı.) Bu bana hangi USSD kodu aradım SİM için IMEI numarası verecektir. (Telefon android kuralları izler ve iki IMEI numaraları sahip olduğu kabul edilir.)
SIM seri numarasını saklamak ve ya SIM/IMSI. Ve sonra başka IMSI algılama eğer telefonu yeniden (yani SIM geçildi) bazı yayın olayı ele alarak bazı günlükleri izleyerek veya olsa bile Seri numarası/.
Arama ile *06# de İMEİ numaraları görmek için alacak. Bu, bir şekilde, bu iki sayıyı almak. (Bir metin için bir ekran yakalama ve görüntü ayrıştırma gibi.)
Eğer herkes başka yollar düşünebilir, en hoş geldiniz. Gerçekten yardıma bu konuda takdir ediyorum. Eğer biri onlarla temas API veya bağlantıları herhangi üreticileri hakkında herhangi bir bilgi varsa da, lütfen topluluk insanlar ile paylaşın.
CEVAP
23 Mart'15 : . Update
Official multiple SIM API is available now from Android 5.1 onwards
Diğer olası seçenek
KullanabilirsinizJava yansımasıhem IMSI numaralarını almak için.
Bu IMSI numaralarını kullanarak telefonun ÇİFT SIM olup olmadığını kontrol edebilirsiniz.
Etkinlik aşağıdaki deneyin :
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TelephonyInfo telephonyInfo = TelephonyInfo.getInstance(this);
String imsiSIM1 = telephonyInfo.getImsiSIM1();
String imsiSIM2 = telephonyInfo.getImsiSIM2();
boolean isSIM1Ready = telephonyInfo.isSIM1Ready();
boolean isSIM2Ready = telephonyInfo.isSIM2Ready();
boolean isDualSIM = telephonyInfo.isDualSIM();
TextView tv = (TextView) findViewById(R.id.tv);
tv.setText(" IME1 : " imsiSIM1 "\n"
" IME2 : " imsiSIM2 "\n"
" IS DUAL SIM : " isDualSIM "\n"
" IS SIM1 READY : " isSIM1Ready "\n"
" IS SIM2 READY : " isSIM2Ready "\n");
}
}
Ve buradaTelephonyInfo.java
:
import java.lang.reflect.Method;
import android.content.Context;
import android.telephony.TelephonyManager;
public final class TelephonyInfo {
private static TelephonyInfo telephonyInfo;
private String imsiSIM1;
private String imsiSIM2;
private boolean isSIM1Ready;
private boolean isSIM2Ready;
public String getImsiSIM1() {
return imsiSIM1;
}
/*public static void setImsiSIM1(String imsiSIM1) {
TelephonyInfo.imsiSIM1 = imsiSIM1;
}*/
public String getImsiSIM2() {
return imsiSIM2;
}
/*public static void setImsiSIM2(String imsiSIM2) {
TelephonyInfo.imsiSIM2 = imsiSIM2;
}*/
public boolean isSIM1Ready() {
return isSIM1Ready;
}
/*public static void setSIM1Ready(boolean isSIM1Ready) {
TelephonyInfo.isSIM1Ready = isSIM1Ready;
}*/
public boolean isSIM2Ready() {
return isSIM2Ready;
}
/*public static void setSIM2Ready(boolean isSIM2Ready) {
TelephonyInfo.isSIM2Ready = isSIM2Ready;
}*/
public boolean isDualSIM() {
return imsiSIM2 != null;
}
private TelephonyInfo() {
}
public static TelephonyInfo getInstance(Context context){
if(telephonyInfo == null) {
telephonyInfo = new TelephonyInfo();
TelephonyManager telephonyManager = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE));
telephonyInfo.imsiSIM1 = telephonyManager.getDeviceId();;
telephonyInfo.imsiSIM2 = null;
try {
telephonyInfo.imsiSIM1 = getDeviceIdBySlot(context, "getDeviceIdGemini", 0);
telephonyInfo.imsiSIM2 = getDeviceIdBySlot(context, "getDeviceIdGemini", 1);
} catch (GeminiMethodNotFoundException e) {
e.printStackTrace();
try {
telephonyInfo.imsiSIM1 = getDeviceIdBySlot(context, "getDeviceId", 0);
telephonyInfo.imsiSIM2 = getDeviceIdBySlot(context, "getDeviceId", 1);
} catch (GeminiMethodNotFoundException e1) {
//Call here for next manufacturer's predicted method name if you wish
e1.printStackTrace();
}
}
telephonyInfo.isSIM1Ready = telephonyManager.getSimState() == TelephonyManager.SIM_STATE_READY;
telephonyInfo.isSIM2Ready = false;
try {
telephonyInfo.isSIM1Ready = getSIMStateBySlot(context, "getSimStateGemini", 0);
telephonyInfo.isSIM2Ready = getSIMStateBySlot(context, "getSimStateGemini", 1);
} catch (GeminiMethodNotFoundException e) {
e.printStackTrace();
try {
telephonyInfo.isSIM1Ready = getSIMStateBySlot(context, "getSimState", 0);
telephonyInfo.isSIM2Ready = getSIMStateBySlot(context, "getSimState", 1);
} catch (GeminiMethodNotFoundException e1) {
//Call here for next manufacturer's predicted method name if you wish
e1.printStackTrace();
}
}
}
return telephonyInfo;
}
private static String getDeviceIdBySlot(Context context, String predictedMethodName, int slotID) throws GeminiMethodNotFoundException {
String imsi = null;
TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
try{
Class<?> telephonyClass = Class.forName(telephony.getClass().getName());
Class<?>[] parameter = new Class[1];
parameter[0] = int.class;
Method getSimID = telephonyClass.getMethod(predictedMethodName, parameter);
Object[] obParameter = new Object[1];
obParameter[0] = slotID;
Object ob_phone = getSimID.invoke(telephony, obParameter);
if(ob_phone != null){
imsi = ob_phone.toString();
}
} catch (Exception e) {
e.printStackTrace();
throw new GeminiMethodNotFoundException(predictedMethodName);
}
return imsi;
}
private static boolean getSIMStateBySlot(Context context, String predictedMethodName, int slotID) throws GeminiMethodNotFoundException {
boolean isReady = false;
TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
try{
Class<?> telephonyClass = Class.forName(telephony.getClass().getName());
Class<?>[] parameter = new Class[1];
parameter[0] = int.class;
Method getSimStateGemini = telephonyClass.getMethod(predictedMethodName, parameter);
Object[] obParameter = new Object[1];
obParameter[0] = slotID;
Object ob_phone = getSimStateGemini.invoke(telephony, obParameter);
if(ob_phone != null){
int simState = Integer.parseInt(ob_phone.toString());
if(simState == TelephonyManager.SIM_STATE_READY){
isReady = true;
}
}
} catch (Exception e) {
e.printStackTrace();
throw new GeminiMethodNotFoundException(predictedMethodName);
}
return isReady;
}
private static class GeminiMethodNotFoundException extends Exception {
private static final long serialVersionUID = -996812356902545308L;
public GeminiMethodNotFoundException(String info) {
super(info);
}
}
}
Düzenleme :
Yöntemlerden elde access "" SIM yuvası ayrıntı yöntem bulunduğunu tahmin etmiştir. diğer getDeviceİdGemini gibi
Bu yöntemin adı çalışmaz daha bir aygıt üreticisi tarafından verilen ile uyuşmuyor. İlgili yöntem adı bulmak için bu cihazlar için.
Diğer üreticiler için yöntem bulmak adları şöyle: Java yansıma kullanılarak yapılabilir
public static void printTelephonyManagerMethodNamesForThisDevice(Context context) {
TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
Class<?> telephonyClass;
try {
telephonyClass = Class.forName(telephony.getClass().getName());
Method[] methods = telephonyClass.getMethods();
for (int idx = 0; idx < methods.length; idx ) {
System.out.println("\n" methods[idx] " declared by " methods[idx].getDeclaringClass());
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
DÜZENLEME :
Seetha ona yorum: belirttiği gibi
telephonyInfo.imsiSIM1 = getDeviceIdBySlot(context, "getDeviceIdDs", 0);
telephonyInfo.imsiSIM2 = getDeviceIdBySlot(context, "getDeviceIdDs", 1);
Onun için çalışıyor. Samsung İkilisi, her iki SIM cihaz için iki IMEI numaralarını almak başarılı oldu.
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
ekleyin
EDİT 2 :
Yöntem veri almak için kullanılan üretim tarafından Lenovo A319 ve diğer telefonlar (Kredi Maher Abuthraa):
telephonyInfo.imsiSIM1 = getDeviceIdBySlot(context, "getSimSerialNumberGemini", 0);
telephonyInfo.imsiSIM2 = getDeviceIdBySlot(context, "getSimSerialNumberGemini", 1);
Android; eğer dosya yeni bir tane oluş...
Eğer nesne dizisi olup olmadığını kont...
Nasıl bir dize bir sayı (yüzen) olup o...
Nasıl bir hizmet Android üzerinde çalı...
Eğer jQuery ile checkbox işaretli olup...