Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /Need Permission
- <uses-permission android:name="android.permission.READ_PHONE_STATE" />
- //Global veriable
- private String deviceImei;
- //Get device IMEI
- TelephonyManager mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
- assert mTelephonyManager != null;
- deviceImei = mTelephonyManager.getDeviceId();
- Log.e(TAG, "IMEI: " + deviceImei);
- //Need this checking because some emulator return "---" as IMEI
- if (deviceImei != null && deviceImei.matches("[0-9]+")) {
- } else
- Utils.showAlert("Info", "This app doesn't support in your device.", mContext, "Ok");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement