[Android] Security Permission Issue in Android

If you follow the API in Android SDK to develop Android application, you will encounter the some permission can’t be used even if you have been defined the permission statement in AndroidManifest.xml.
For example, 
I have been declared the REBOOT permission in AndroidManifest.xml
  <uses-permission android:name=”android.permission.REBOOT”></uses-permission>

In the Android application, I use the reboot API for rebooting system, 
        Context c = this.getApplicationContext();
        PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
        pm.reboot(“recovery”);

But I always get the message says I don’t have the permission to reboot system.
  E/AndroidRuntime(  549): java.lang.RuntimeException: Unable to start activity
  ComponentInfo{com.android.testproject/com.android.testproject.TestProject}:
  java.lang.SecurityException: Neither user 10034 nor current process has android.permission.REBOOT.


Why? How to solve this problem?

If you want to grant the permission, your application must be signed with the platform key.
Unfortunately, the key is different for manufacturers, so you can’t only change the signature for different platform. 

KRISHNARAJ VARMA had explained that some permission should not be used immediately in the 

.


發佈留言