Android examples for Phone:Sim
get SIM Imei By Slot
//package com.java2s; import android.content.Context; import android.telephony.TelephonyManager; import java.lang.reflect.Method; public class Main { public static String getImeiBySlot(Context context, int slotID) { String imei = ""; if (context == null) { return ""; }//from www .j ava 2 s . c o m if (slotID < 0 || slotID > 1) { return ""; } try { TelephonyManager telephonyManager = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); Class<?> mLoadClass = Class .forName("android.telephony.TelephonyManager"); Class<?>[] parameter = new Class[1]; parameter[0] = int.class; Method getImei = mLoadClass.getMethod("getDeviceIdGemini", parameter); Object[] obParameter = new Object[1]; Object ob_imei = null; obParameter[0] = slotID; ob_imei = getImei.invoke(telephonyManager, obParameter); if (ob_imei != null) { imei = ob_imei.toString(); } } catch (Exception e) { // T.warn("DoubleSimPhoneUtil:007:" + e.toString()); } return imei; } }