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.

Posted on May 29, 2023 3:23 AM

Reply
Question marked as Top-ranking reply

Posted on May 29, 2023 12:44 PM

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


7 replies
Question marked as Top-ranking reply

May 29, 2023 12:44 PM in response to etresoft

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


May 29, 2023 8:33 AM in response to haider_1123

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.

May 29, 2023 11:25 PM in response to MrHoffman

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.

May 30, 2023 9:01 AM in response to haider_1123

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.


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Airplane mode detection in iOS?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.