Permission is only granted to system app
In Eclipse:
Window -> Preferences -> Android -> Lint Error Checking.
In the list find an entry with ID = ProtectedPermission
. Set the Severity to something lower than Error. This way you can still compile the project using Eclipse.
In Android Studio:
File -> Settings -> Editor -> Inspections
Under Android Lint
, locate Using system app permission
. Either uncheck the checkbox or choose a Severity lower than Error.
Permission is only granted to system app, in Manifest
MODIFY_PHONE_STATE
permission is granted to system apps only.
For your information, there are 2 types of Android apps: system & user
User apps are just all your normal app installations through the Google Play Store, Amazon Appstore or sideloading. These go into the /data partition of your Android phone, which is the part of the internal memory made available for user data and apps.
System apps are basically the apps that come pre-installed with your ROM. In a standard Android user environment, the user doesn’t have write access to the /system partition and thus, installing or uninstalling system apps directly isn’t possible.
In order to install an app as a system app on your Android device,
your device must either be rooted or have a custom recovery installed (or both).
That being said, that error is actually wrong because you have a valid code and compilation should work. It would be better if it gave a warning instead. In Eclipse you can easily fix it. Just go to:
Window -> Preferences -> Android -> Lint Error Checking.
Find ProtectedPermission
from the list and set the severity to something other than error(info for example). This way your project will still compile.
Is android.permission.WRITE_SETTINGS only granted to system apps?
As stated by user passsy in the stackoverflow question provided by Brian, android.permission.WRITE_SETTINGS
has a android:protectionLevel
of "signature"
, which makes the permission unavailable for use in user applications since API level 23.
See https://developer.android.com/guide/topics/manifest/permission-element#plevel for the description of protection levels for permissions.
I cannot grant the following permission on my app..Kindly suggest any alternative?
Permissions with the protection level signature or signatureOrSystem
are only granted to system apps. If an app is a regular non-system
app, it will never be able to use these permissions.So,what should i do now?
If your app is expected to run on non-rooted devices, then you're simply doomed - you can do nothing, unless you have platform keys to sign your app with it.
Alternatively, you may narrow your audience to rooted devices only but that would allow you to do what you want incl. using features usually reserved for the platform or system apps ony.
Finally you may rethink your approach. Perhaps what you want to do can be achieved other way, w/o need of elevating app privileges.
permission is only granted to system application
From Android Documentation about permissions:
public static final String INSTALL_PACKAGES
Added in API level 1
Allows an application to install packages.
**Not for use by third-party applications.**
Constant Value: "android.permission.INSTALL_PACKAGES"
system app permission issue
How will I give permission at install time to it won't ask for any
permission at runtime?
If you are running your app on OS version >= Android M (API 23) and targetSdkVersion
is set to >= 23, permissions falling under dangerous category (storage/location permissions fall under this category) have to be granted at run-time. Even System apps are not exempted from this request.
For generic apps only the normal-level permissions are granted at installation time. Since your app is signed with firmware key the advantage it gets is, the normal-level as well as signature-level permissions will be granted at installation time. Refer to official document for more details.
Related Topics
Webview's HTML Button Click Detection in Activity
Findviewbyid VS View Holder Pattern in Listview Adapter
Why Do I Get "Unresolved Reference" Error for My View's Name/Id When I Type It in Kotlin
How to Keep/Exclude a Particular Package Path When Using Proguard
Dialogs/Alertdialogs: How to "Block Execution" While Dialog Is Up (.Net-Style)
How to Set the Edittext Keyboard to Only Consist of Numbers on Android
Notifydatasetchange Not Working from Custom Adapter
How to Save Hashmap to Shared Preferences
Spannablestring with Image Example
How to Change the Color of Header Bar and Address Bar in Newest Chrome Version on Lollipop
Making a Triangle Shape Using Xml Definitions
Apply a Theme to an Activity in Android
How to Define a Circle Shape in an Android Xml Drawable File
How to Prevent a Service from Being Killed by Os
Android: Using Findviewbyid() with a String/In a Loop
How to Add Java.Awt.Image Package in Android
Ffmpeg for a Android (Using Tutorial: "Ffmpeg and Android.Mk")