Android的一套服务状态 [英] Android set Service state

查看:162
本文介绍了Android的一套服务状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图以编程方式关闭了Android收音机。我试图用ServiceState类,但它不会工作。我加了许可 CHANGE_NETWORK_STATE和MODIFY_PHONE_STATE 。仍然没有运气。任何想法?

I'm trying to turn off the android radio programmatically. I'm trying to use the ServiceState class, but it wont work. I added the permission CHANGE_NETWORK_STATE and MODIFY_PHONE_STATE. Still no luck. any ideas?

推荐答案

权限 MODIFY_PHONE_STATE 是一个系统的权限,因此你不能在你的应用程序中使用它。

Permission MODIFY_PHONE_STATE is a system permission, thus, you cannot use it in your application.

编辑:

确定。我会尽力解释。该服务的方法来打开和关闭无线电编程保护与MODIFY_PHONE_STATE许可。此权限有签名类型,因此,只有具有相同的签名可以调用此方法的应用程序。因此,使您的应用程序与系统不证书签名,你不能在你的应用程序中使用此权限。但是,如果没有此权限也无法改变无线电的状态。

Ok. I'll try to explain. The service method to turn on and turn off radio programatically is protected with MODIFY_PHONE_STATE permission. This permission has signature type, thus, only applications that have the same signature can invoke this method. Thus, so as your application is not signed with the system certificate you cannot use this permission in your application. But without this permission you also cannot change the state of the radio.

这篇关于Android的一套服务状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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