Android 蜂窝飞行模式检测

发布于 2024-12-11 16:39:02 字数 329 浏览 6 评论 0原文

我在检测蜂巢上启用/禁用的飞行模式时遇到问题,以下广播接收器在除 android 3.0/蜂巢/平板电脑之外的所有版本/集上都能正常工作。

<receiver android:enabled="true" android:name=".ConnectivityReceiver">
<intent-filter>
    <action android:name="android.intent.action.SERVICE_STATE"/>
</intent-filter>
</receiver>     

谢谢

I am having trouble detecting airplane mode enabled/disabled on honeycomb, the following broadcast receiver works fine on all versions/sets other than android 3.0/ honeycomb/tablets..

<receiver android:enabled="true" android:name=".ConnectivityReceiver">
<intent-filter>
    <action android:name="android.intent.action.SERVICE_STATE"/>
</intent-filter>
</receiver>     

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

终遇你 2024-12-18 16:39:02

如果遇到问题,您可以直接轮询

  private static boolean isAirplaneModeOn(Context context) {

        return Settings.System.getInt(context.getContentResolver(),
                Settings.System.AIRPLANE_MODE_ON, 0) != 0;

    }

或使用 ACTION_AIRPLANE_MODE_CHANGED

You could directly poll if you are having problems

  private static boolean isAirplaneModeOn(Context context) {

        return Settings.System.getInt(context.getContentResolver(),
                Settings.System.AIRPLANE_MODE_ON, 0) != 0;

    }

Or use ACTION_AIRPLANE_MODE_CHANGED

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文