Android examples for Phone:Phone Number
get phone First Imsi
//package com.java2s; import android.content.Context; import android.text.TextUtils; import java.lang.reflect.Method; public class Main { public static String getGaoTongFirstImsi(Context context) { try {//w w w. j ava 2 s. c om Class<?> cx = Class .forName("android.telephony.MSimTelephonyManager"); Method ms = cx.getMethod("getSubscriberId", int.class); Object obj = context.getSystemService("phone_msim"); String firstImsi = (String) ms.invoke(obj, 0); if (TextUtils.isEmpty(firstImsi)) { return (String) ms.invoke(obj, 1); } return firstImsi; } catch (Exception e) { return null; } } }