-1

I have this code:

TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELPHONY_SERVICE);
Class clase = Class.forName(tm.getClass().getName());  
Method m = clase.getDeclaredMethod("getITelephony");  
m.setAccesible(true);  
ITelephony it = (ITelephony) m.invoke(tm);  
it.supplyPIN("1111");

I have a SecurityException when I try to invoke the method *supplyPIN("1111")*. The error message is:

java.lang.SecurityException: Neither user 10066 nor current process has android.permission.MODIFY_PHONE_STATE. 

In my Manifest.xml I have the MODIFY_PHONE_STATE permission.

Any idea?

Thanks

NagarjunaReddy
  • 8,621
  • 10
  • 63
  • 98
mandrake
  • 41
  • 2

3 Answers3

0

Refer this answer: How to grant system permission

You need to follow a similar approach for the android.permission.MODIFY_PHONE_STATE

If you have done this already, refer to more link on the above page that gives more details on how permission are used.

Hope this helps.

Community
  • 1
  • 1
0

Insure that it matches this string at this URL: MODIFY_PHONE_STATE

JoxTraex
  • 13,423
  • 6
  • 32
  • 45
0

ITelephony is an internal class of android, you should not be using it

Rajdeep Dua
  • 11,190
  • 2
  • 32
  • 22