3

I Have created Android App. And Before Api 29 I was get Device IMEI Id. Now Api 29 my methods return null.

TelephonyManager tm  = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

            if (tm.getDeviceId() != null) {
               String imei=tm.getDeviceId();
            }

Android Documentation says that new version you must use new permission. Permission is READ_PRIVILEGED_PHONE_STATE but When I send it is not show to users for choose

ActivityCompat.requestPermissions(this,   
                new String[]{"android.permission.READ_PRIVILEGED_PHONE_STATE"},
                PERMISSIONS_CODE );

not showing. How I pass this problem?

  • To use that permission you need to be "pre-installed" in the system area like `/system/priv-app`, then you can read IMEI if you have that permission in your Manifest and on the system area – Ivor Nov 04 '21 at 12:05

0 Answers0