get Imsi - Android android.telephony

Android examples for android.telephony:TelephonyManager

Description

get Imsi

Demo Code


//package com.java2s;

import android.content.Context;

import android.telephony.TelephonyManager;

public class Main {
    private static Context mContext;
    private static TelephonyManager mTelephonyManager;

    public static String getImsi() {
        String imsi = "";
        imsi = getTelephonyManager().getSubscriberId();
        return imsi;
    }/*from w  w w . j  av  a2s .  c o  m*/

    private static TelephonyManager getTelephonyManager() {
        if (mTelephonyManager == null)
            mTelephonyManager = (TelephonyManager) mContext
                    .getSystemService(Context.TELEPHONY_SERVICE);
        return mTelephonyManager;
    }
}

Related Tutorials