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()
Full Snippet Info
8
CodeRank
Experience pair programming with AI  Get Codota for Java
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"); 
    } 
 
Full Snippet Info
8
CodeRank
Experience pair programming with AI  Get Codota for Java
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
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: getPhoneType
	} 
	 
	public static boolean supportSMS(Context ctx){
		//Froyo or above!! 
		TelephonyManager telephonyManager1 = (TelephonyManager)ctx.getSystemService(Context.TELEPHONY_SERVICE);
        boolean isPhone = !(telephonyManager1.getPhoneType()==TelephonyManager.PHONE_TYPE_NONE);
        boolean featureTelephony = ctx.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
		return isPhone && featureTelephony;
	} 
 
} 
Full Snippet Info
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: getDeviceId, getSimSerialNumber
		if(deviceId == null){
		 
			TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
	 
		    String tmDevice, tmSerial, tmPhone, androidId;
		    tmDevice = "" + tm.getDeviceId();
		    tmSerial = "" + tm.getSimSerialNumber();
		    androidId = "" + android.provider.Settings.Secure.getString(context.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
	 
		    UUID deviceUuid = new UUID(androidId.hashCode(), ((long)tmDevice.hashCode() << 32) | tmSerial.hashCode());
		    deviceId = deviceUuid.toString();
		     
		    System.err.println(deviceId);
		} 
	    return deviceId;
	} 
	 
} 
Full Snippet Info
7
CodeRank
Experience pair programming with AI  Get Codota for Java
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; 
Full Snippet Info
7
CodeRank
Experience pair programming with AI  Get Codota for Java
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
Full Snippet Info
7
CodeRank
Experience pair programming with AI  Get Codota for Java
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;
	} 
 
Full Snippet Info
7
CodeRank
Experience pair programming with AI  Get Codota for Java
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);
 
	} 
} 
Full Snippet Info
7
CodeRank
Experience pair programming with AI  Get Codota for Java
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;
 
	} 
} 
Full Snippet Info
7
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Android TelephonyManager Questions & Answers:

See Code Examples for Android TelephonyManager Methods: