怎么实现关机,关闭gprs ?好像没有提供api,有人说可以用隐藏api,怎么实现?
解决方案 »
- android 扑克类游戏请教
- android程序自动更新安装详解.doc
- 谁有编译过的Android2.2的源码?可以发给我吗,不胜感激
- pull解析xml
- inputstream 被读取一次后就被为空
- eclipse自动编译问题
- 请问怎么在不继承Activity的类里使用Resources
- Android将联系人信息放到ListView时报空指针异常
- 新人求助:关于listview 使用SimpleCursorAdapter问题
- 几个与Android开发环境搭建有关的问题,希望有好心人愿意帮忙解答?
- 手把手教你搭建开发环境 并附sdk离线包,及其所有资源,求置顶
- android新手问题,在线求教?
在frameworks/base/services/java/com/android/server/BatteryService.javaIntent intent = new Intent(Intent.ACTION_REQUEST_SHUTDOWN);
intent.putExtra(Intent.EXTRA_KEY_CONFIRM, false);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);
关于ACTION_SHUTDOWN :
This is a protected intent that can only be sent by the system.
我查到可以用
Settings.Secure.setLocationProviderEnabled(resolver, LocationManager.GPS_PROVIDER, state);
这个方法开启GPS,而且在android 2.2中已经开放了这个函数。
我在AndroidManifest.xml中也添加了
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
为何我在SDK2.2下运行依然提示:
"java.lang.SecurityException:Permission denial:writing to secure settings requires android.permission.WRITE_SECURE_SETTINGS" ?