简体   繁体   中英

How to grant permission without user interaction in marshmallow for system app?

Currently I am working on an utility app which does not have any user interface.This is a system application which will be installed along with other android packages. I am running a service which will stop once done with its assigned tasks.Some tasks require some critical permissions like send sms, write something to external storage etc. To check for permissions in marshmallow Activity is needed.I don't want to interact with user.I don't to use even transparent activity. Is system app require uses permissions in marshmallow ? Is there any api which help me to grant permission without any user interaction ?

您可以使用targetSdkVersion = 22和compileSdkVersion = 24(以支持棉花糖设备)构建应用程序,以避免处理用户权限。

Even if it is a system app, you should handle user permission gracefully. This is normal way of handling it. Also, there is another way of doing it, you can use the android:sharedUserId property in the manifest. you can share the userID of the application which has already granted permission's which your application need.

A word of caution here, whichever app you choose, you need their signature in order to install the application.

Read more about android:sharedUserId

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM