Airplane mode detection in iOS?
Is there any available way from iOS to detect Airplane mode status?
I am avoiding to use any private api as this can result in app rejection while submitting to AppStore.
Is there any available way from iOS to detect Airplane mode status?
I am avoiding to use any private api as this can result in app rejection while submitting to AppStore.
etresoft wrote:
Requirement from whom? As far as I know, Apple doesn't provide an API to detect airplane mode.
Inferring much… OP is implementing an app to a spec. The app spec has an… ill-considered… requirement; that there should be a message shown suggesting disabling airplane mode.
OP is thus seeking independent confirmation for their findings; that the particular requirement in the app spec is best renegotiated with the party funding the app. This because there is no documented API for the switch setting AFAIK, and because the default for airplane mode has active Wi-Fi and Bluetooth networking. The switch controls only cellular, by default.
Now there are ways to detect network instabilities and outages, and which network transport you’re using. (e.g. cellular) But for detecting the airplane mode control setting, not so much.
Old, semi-relevant, but still interesting: About Networking
etresoft wrote:
Requirement from whom? As far as I know, Apple doesn't provide an API to detect airplane mode.
Inferring much… OP is implementing an app to a spec. The app spec has an… ill-considered… requirement; that there should be a message shown suggesting disabling airplane mode.
OP is thus seeking independent confirmation for their findings; that the particular requirement in the app spec is best renegotiated with the party funding the app. This because there is no documented API for the switch setting AFAIK, and because the default for airplane mode has active Wi-Fi and Bluetooth networking. The switch controls only cellular, by default.
Now there are ways to detect network instabilities and outages, and which network transport you’re using. (e.g. cellular) But for detecting the airplane mode control setting, not so much.
Old, semi-relevant, but still interesting: About Networking
haider_1123 wrote:
Is there any available way from iOS to detect Airplane mode status?
I am avoiding to use any private api as this can result in app rejection while submitting to AppStore.
There’s no difference between airplane mode and unstable or unavailable network connections, and handling unstable or unavailable network connections also means thar the user can freely tap-dance on the airplane mode control. As some users are wont to do.
Handing network instability means the app can also handle airplane mode.
Airplane mode shuts off cellular, and Bluetooth and Wi-Fi can be available or can be unavailable, too.
Apple used to have a Reachability sample available that could be helpful here, and there is at least one third-party version of that code still being maintained:
… https://github.com/tonymillion/Reachability
I’m unaware of a supported means to resolve that control-sniffing requirement in your app specs. The generic “no network” messaging expected and necessary within most any networking app will have to suffice. And you can have both Wi-Fi and Bluetooth network connectivity when airplane mode is engaged, so the control-sniffing message is… unhelpful.
Thanks for replying on my query and understanding my requirement.
In sum of this thread discussion, we don't have any api/function provided by Apple to detect Airplane mode detection.
We can detect network and mobile data availability but network can be unavailable by poor network connection and mobile data can be turn off by user manually in iOS settings.
WiFi and Bluetooth can be toggled while being on Airplane mode. Hence can't depend upon that also.
So we can only assume that if Mobile data is turn off and network not available. Then user has enabled Airplane mode for now.
Hope I am understanding it right.
haider_1123 wrote:
There is some specific requirement in which I need to show a message to user if able to detect Airplane mode.
Requirement from whom? As far as I know, Apple doesn't provide an API to detect airplane mode.
haider_1123 wrote:
WiFi and Bluetooth can be toggled while being on Airplane mode. Hence can't depend upon that also.
Both Wi-Fi and Bluetooth are on by default when Airplane mode is selected. Try it. Whoever wrote the spec didn’t.
As presently implemented, the Airplane mode switch controls cellular network access. Not networking more generally.
Why do you want to detect airplane mode status? Why not just write your software to work correctly even when no network is available?
Thanks for replying on my query.
My software is working fine in online and offline related requirements.
There is some specific requirement in which I need to show a message to user if able to detect Airplane mode.
Airplane mode detection in iOS?