Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Activate Ant+ while phone in flight mode?

Rank

Total Posts: 1

Joined 2015-11-04

PM

Hi,
I have a Sony Xperia Z1c which I use with the Garmin Fit app.
I would like to be able to use my Ant+ devices while my phone is in Flight mode.
Is this in anyway possible?      
RankRankRankRank

Total Posts: 313

Joined 2011-09-12

PM

Manufacturers can block ANT in airplane mode if they chose to do so, however I don't recall Sony ever doing so. Otherwise current versions of the ANT Radio Service should allow ANT to be re-enabled after airplane mode is turned on.

ANT is re-enabled when an app requests to use an ANT adapter, so you may have to force your app to reconnect by toggling the sensors on or off or closing the app completely with the back button and re-opening it. (Alternatively, you can do it with another app, like you could open one of our demos on the Play Store like the ANT+ Plugin Sampler or ANT+ Heart Rate Grapher and start a device search)      

Signature

Dynastream Developer

Rank

Total Posts: 23

Joined 2013-02-06

PM

Confirmed. Sony Z1 compact with Android 5.1.1 turns off ANT chip in airplane mode.      
RankRankRankRank

Total Posts: 313

Joined 2011-09-12

PM

@driscollta It's normal for ANT to turn off in airplane mode, we make that the default behaviour. I guess I could have phrased it more clearly, but unless the manufacturer explicitly blocks it, you should be able to turn it back on while airplane mode is still enabled. Most Android phones support this behaviour with Wi-Fi or BT for example, where you turn airplane mode on and everything turns off, but then you can re-enable each service individually while keeping airplane mode enabled.      

Signature

Dynastream Developer

Rank

Total Posts: 23

Joined 2013-02-06

PM

In order to modify AIRPLANE_MODE_RADIOS in API > 17 one needs android.permission.SETTINGS_SECURE_WRITE, which is reserved for System apps.

My radios-list shown below:
11-30 15:55:41.082: W/CycleBike+(28571): Airplane mode radios list: cell,bluetooth,wifi,nfc,wimax,ant

see http://developer.android.com/reference/android/provider/Settings.Global.html

"Global system settings, containing preferences that always apply identically to all defined users. Applications can read these but are not allowed to write; like the "Secure" settings, these are for preferences that the user must explicitly modify through the system UI or specialized APIs for those values. "

Unless you know another way ...      
RankRankRankRank

Total Posts: 313

Joined 2011-09-12

PM

@driscollta There is no need to modify the airplane radio list, that one only controls if it is turned off when the airplane mode is toggled, but doesn't prevent it from turning back on.

The main one that matters is the airplane_mode_toggleable_radios list (see https://github.com/ant-wireless/ANT_in_Android/tree/master/android_patches/airplane_mode). We respect these lists in our service like this:

if((onAirplane && onToggleable)) || notOnAnyLists) then turn off when airplane mode is enabled, but allow to reenable even if airplane mode is on

if(onAirplane && !onToggleable) then turn off when airplane mode is enabled and don't allow turning on until airplane mode is enabled

if(!onAirplane && onToggleable) ignore airplane mode completely (don't turn off, always allow enable)


As you said, these lists are not editable by apps, so if the phone manufacturer has set them differently then what you prefer, you have to find a way to edit it on your own.      

Signature

Dynastream Developer