Reputation: 3685
I have a mobile phone with dual sim. If I want to turn on Airplane mode, its happening for both sim.
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?
As I can see this in the docs:
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.
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?
Thanks in advance.
Upvotes: 0
Views: 1256
Reputation: 2319
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?
There's no official Android API which supports this. Additionally, I'm not aware of any vendor/device specific SDKs which provides such an 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?
The example in this blog post has nothing to do with airplane mode.
Edit: Please also note that airplane mode isn't related to the SIM cards but to the connectivity hardware, e.g., Wi-Fi, Bluetooth, or cell radio modules. Thus, when enabling airplane mode this hardware is turned off. Depending on the device only one cell radio module might be built-in which would make it impossible to restrict airplane mode to a single SIM card.
Upvotes: 1