gpt4 book ai didi

java - 打开/关闭给定网络的飞行模式。

转载 作者:行者123 更新时间:2023-12-01 12:04:05 26 4
gpt4 key购买 nike

我有一部双卡手机。如果我想打开飞行模式,两个 SIM 卡都会发生这种情况。

是否可以通过编程方式仅对一张SIM卡进行操作(用户可以选择两者之一)?我看到了here上的帖子,他们一直工作到 API 16。还有其他解决方法吗?

正如我在文档中看到的:

Some device settings defined by Settings.System are now read-only. If your app attempts to write changes to settings defined in Settings.System that have moved to Settings.Global, the write operation will silently fail when running on Android 4.2 and higher. Even if your value for android:targetSdkVersion and android:minSdkVersion is lower than 17, your app is not able to modify the settings that have moved to Settings.Global when running on Android 4.2 and higher.

他们说Settings.System 现在是只读的,但是阅读这些博客,I don't need your permission! ,它解释了如何跳过权限部分,通过这种方式我们可以要求用户授予打开/关闭飞行模式的权限并逃避这里提到的权限问题?

提前致谢。

最佳答案

Is it possible to do for only one sim (user can select the one of the two) programmatically? I saw the posts over here, that they work till API 16. Any other work arounds?

没有官方的 Android API 支持此功能。此外,我不知道有任何供应商/设备特定的 SDK 提供此类 API。

They say Settings.System are now read-only, but reading these blogs,I don't need your permission!, which explains how to skip the permissions part, by this way we can ask the user to give permission to turn on/off the airplane mode and escape the permission issue mentioned here?

这篇博文中的示例与飞行模式无关。

编辑:另请注意,飞行模式与 SIM 卡无关,而是与连接硬件相关,例如 Wi-Fi、蓝牙或蜂窝 radio 模块。因此,当启用飞行模式时,该硬件将被关闭。根据设备的不同,可能只内置一个蜂窝 radio 模块,这将导致无法将飞行模式限制为一张 SIM 卡。

关于java - 打开/关闭给定网络的飞行模式。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27779635/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com