Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

IMEI DEVISE ANDROID JAVA

public static String getDeviceId(Context context) {

 String deviceId;

    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
        deviceId = Settings.Secure.getString(
                context.getContentResolver(),
                Settings.Secure.ANDROID_ID);
    } else {
        final TelephonyManager mTelephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        if (mTelephony.getDeviceId() != null) {
            deviceId = mTelephony.getDeviceId();
        } else {
            deviceId = Settings.Secure.getString(
                    context.getContentResolver(),
                    Settings.Secure.ANDROID_ID);
        }
    }

    return deviceId;
}
 
PREVIOUS NEXT
Tagged: #IMEI #DEVISE #ANDROID #JAVA
ADD COMMENT
Topic
Name
3+9 =