Android TelephonyManager - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android TelephonyManager class.

This code example shows how to use the following methods:getDeviceId
	} 
	 
	public String getUuid()
	{		 
		TelephonyManager operator = (TelephonyManager) mCtx.getSystemService(Context.TELEPHONY_SERVICE);
		String uuid = operator.getDeviceId();
		return uuid;
	} 
	 
	public void init() 
	{ 
		mAppView.loadUrl("javascript:Device.setData('Android','" + version + "','" + this.getUuid() + "')");
	} 
	 
	public String getModel()
	{ 
		String model = android.os.Build.MODEL;
		return model;
	} 
	public String getProductName()
8
CodeRank
This code example shows how to use the following methods:getNetworkCountryIso
        return carrierId;
    } 
 
    public static String getCountryCode(Context context) {
        TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        String countryCode = tm.getNetworkCountryIso();
        if (TextUtils.isEmpty(countryCode)) {
            countryCode = "Unknown";
        } 
        return countryCode;
    } 
 
    public static String getDevice() {
        return SystemProperties.get("ro.cm.device"); 
    } 
 
    public static String getModVersion() {
        return SystemProperties.get("ro.cm.version"); 
    } 
 
8
CodeRank
This code example shows how to use the following methods:getDeviceId, getLine1Number, getNetworkCountryIso, getNetworkOperatorName, getSimCountryIso
		ctx = c;
		tm = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
	} 
	 
	public String getPhoneNumber() {
		return tm.getLine1Number();
	} 
	 
	public String getIMEI() {
		return tm.getDeviceId();
	} 
	 
	public String getCountryCode() {
		return tm.getNetworkCountryIso();
	} 
	 
	public String getOperatorName() {
		return tm.getNetworkOperatorName();
	} 
	 

8
CodeRank
This code example shows how to use the following methods:getPhoneType
This code example shows how to use the following methods:getDeviceId, getSimSerialNumber
This code example shows how to use the following methods:getDeviceId, getPhoneType
    } 
     
     
    public String getIMEI() {
        if(m_allowToReadPhoneState &&
            (m_telMgr.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM)) {
             
            return checkValidString(m_telMgr.getDeviceId());
        } 
        return null; 
    } 
     
     
    public String getIMSI() {
        if(m_allowToReadPhoneState && 
                (m_telMgr.getSimState() == TelephonyManager.SIM_STATE_READY)) {
             
            return checkValidString(m_telMgr.getSubscriberId());
        } 
        return null; 
7
CodeRank
This code example shows how to use the following methods:getNetworkType
    } 
     
    public static boolean is2gNetwork(Context context) {
        TelephonyManager tm = (TelephonyManager) context.
			getSystemService(Context.TELEPHONY_SERVICE);
	    int type = tm.getNetworkType();
	    if (type == TelephonyManager.NETWORK_TYPE_GPRS
	    		|| type == TelephonyManager.NETWORK_TYPE_EDGE) {
	    	return true; 
	    } 
	    return false; 
    } 
     
     
	public static int getCurrentSdkVersion() { 
		return Build.VERSION.SDK_INT;
	} 
	 
	public Location getLocation(Context context) {
		LocationManager locMan = (LocationManager) context
7
CodeRank
This code example shows how to use the following methods:getCallState
	 */ 
	private static boolean isInCall(Context context)
	{ 
		if (sInCall == -1) {
			TelephonyManager manager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
			sInCall = (byte)(manager.getCallState() == TelephonyManager.CALL_STATE_IDLE ? 0 : 1);
		} 
		return sInCall == 1;
	} 
 
	/** 
	 * Set the cached value for whether the phone is in a call. 
	 * 
	 * @param value True if in a call, false otherwise. 
	 */ 
	public static void setInCall(boolean value)
	{ 
		sInCall = value ? 1 : 0;
	} 
 
7
CodeRank
This code example shows how to use the following methods:getSimState
public class SIMUtils { 
 
	public static boolean isSimCardReady(Context context) {
		TelephonyManager mTelephonyManager = (TelephonyManager) context
				.getSystemService(Service.TELEPHONY_SERVICE);
		return (mTelephonyManager.getSimState() == TelephonyManager.SIM_STATE_READY);
 
	} 
} 
7
CodeRank
This code example shows how to use the following methods:getDataState
	} 
 
	private boolean checkConnectivityState(){ 
		final TelephonyManager telephonyManager = (TelephonyManager) mContext
				.getSystemService(Context.TELEPHONY_SERVICE);
		return telephonyManager.getDataState() == TelephonyManager.DATA_CONNECTED;
 
	} 
} 
7
CodeRank

Related Android TelephonyManager Questions & Answers:

See Code Examples for Android TelephonyManager Methods: