0

I need to read IMEI value in opencore source code(c file).

I will use IMEI for drm file encoding.

Some multimedia has not permission for READ_PHONE_STATE permission.

So I need to read IMEI value without permission.

Can I do it?

antyrat
  • 27,479
  • 9
  • 75
  • 76
byungkyu
  • 211
  • 1
  • 5
  • 7

2 Answers2

1

You can't. If there was a way to do something, that requires permission, without granting that permission to application, then there would be no sense to use permission system in the first place.

Having said that, there theoretically might be some hacks, but they will be treated as security flaw and will be fixed in further releases. I would strongly recommend against using them (assuming you find one).

Its much easier to specify what security permissions your DRM library depends on then rely on some hacks.

inazaruk
  • 74,247
  • 24
  • 188
  • 156
-3

You can use following java code to fetch IMEI number without permission.

try {

            TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
            Log.i("TAG", "IMEI : = " + tm.getDeviceId()); 



        } catch (Exception e) {
            e.printStackTrace();
        }
Ketan Parmar
  • 2,962
  • 19
  • 27
  • 1
    If your target SDK is less then 4, your app is automatically requesting permission for READ_PHONE_STATE. You code was working just because READ_PHONE_STATE permissions where requested automatically for you. Read this for more info: http://stackoverflow.com/questions/1747178/android-permissions-phone-calls-read-phone-state-and-identity – inazaruk May 18 '11 at 15:20