修改AIRPLANE_MODE_ON在Android 4.2(及以上) [英] Modify AIRPLANE_MODE_ON on Android 4.2 (and above)

查看:606
本文介绍了修改AIRPLANE_MODE_ON在Android 4.2(及以上)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于SDK 4.2版本好像它不再是可以修改飞机模式的设备,因为谷歌已经移到此设置Settings.Global是只读的。

Since the sdk version 4.2 it seems like it's no longer possible to modify airplane-mode on devices since google has moved this setting to Settings.Global which is read-only.

有没有人能够绕过这个不厚道生根?

Has anyone been able to bypass this without and kind of rooting?

我的应用程序的主要功能是使飞机的模式,当屏幕处于关闭状态,而这种停止,因为4.2的工作。

My apps primary function is to enable airplane-mode when the screen is turned off, and this stopped working since 4.2.

只是想仔细检查我的判断是正确的,我的应用程序从Android的4.2及以上的死亡开始。

Just want to double check that my assessment is correct and that my app is dead starting from android 4.2 and above.

参考: <一href="http://developer.android.com/reference/android/provider/Settings.Global.html#AIRPLANE_MODE_ON">http://developer.android.com/reference/android/provider/Settings.Global.html#AIRPLANE_MODE_ON

推荐答案

我知道你明确要求的解决方案,而生根,但如果你有一个根深蒂固的设备有(种)至少官方的解决方案,以将您的应用程序到文件夹 /系统/应用程序。然后就可以写入 Settings.Global

I know you explicitly ask for a solution without rooting, but if you have a rooted device there is at least the (kind of) official solution to move your app into folder /system/app. Then it is possible to write into Settings.Global:

Settings.Global.putInt(context.getContentResolver(), Global.AIRPLANE_MODE_ON, mode ? 1 : 0);

对于如何<一看href="https://bitbucket.org/jholetzeck/ministatus-android/src/2f66bc57b4ca7a4f46181b05be47d91ca5456e9a/src/de/holetzeck/ministatus/AirplaneMode_SDK17.java?at=default"相对=nofollow>切换飞行模式4.2 以及如何将你的应用程序到 /系统/应用程序 <一个href="https://bitbucket.org/jholetzeck/ministatus-android/src/2f66bc57b4ca7a4f46181b05be47d91ca5456e9a/src/de/holetzeck/ministatus/MiniStatusSettings.java?at=default"相对=nofollow>此处。我用这对我的切换小部件的迷你状态的(源$ C ​​$ C链接)。

Have a look of how to toggle airplane mode for 4.2 and how to move your app into /system/app here. I use this for my toggle widget Mini Status (source code link).

这篇关于修改AIRPLANE_MODE_ON在Android 4.2(及以上)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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