在 Android 4.2(及更高版本)上修改 AIRPLANE_MODE_ON [英] Modify AIRPLANE_MODE_ON on Android 4.2 (and above)

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

问题描述

自 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.

参考资料:http://developer.android.com/reference/android/provider/Settings.Global.html#AIRPLANE_MODE_ON

推荐答案

我知道你明确要求没有 root 的解决方案,但如果你有一个 root 的设备,至少有(某种)官方解决方案来移动你的应用程序进入文件夹 /system/app.然后就可以写入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);

看看如何为 4.2 切换飞行模式以及如何将您的应用移动到 /system/app 这里.我将它用于我的切换小部件 Mini Status(源代码链接).

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).

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

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