如何在没有用户交互的情况下为系统应用程序授予权限? [英] How to grant permission without user interaction in marshmallow for system app?

查看:52
本文介绍了如何在没有用户交互的情况下为系统应用程序授予权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在开发一个没有任何用户界面的实用程序.这是一个系统应用程序,将与其他 android 软件包一起安装.我正在运行一项服务,一旦完成其分配的任务,该服务就会停止.某些任务需要一些关键权限,例如发送短信、向外部存储写入内容等.需要检查棉花糖活动中的权限.我不想与用户交互.我什至不使用透明活动.系统应用程序是否需要在棉花糖中使用权限?是否有任何 api 可以帮助我在没有任何用户交互的情况下授予权限?

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(以支持 marshmallow 设备)构建您的应用程序,以避免处理用户权限.

You can build your app with targetSdkVersion=22 and compileSdkVersion=24 (to support marshmallow devices) in order to avoid handling user permissions.

这篇关于如何在没有用户交互的情况下为系统应用程序授予权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆