1

I would like to find out at what time my phone (running Android 8.0.0) was last switched into/out of Flight (Airplane) Mode. Ideally, this would be part of a longer log with the timestamps of the last N FlightMode events, alongside other system-related events.

I didn't find any quick solutions by searching this site and others. Is there an easy way to find out this information?

1

You can use for this. Run this command:

adb shell dumpsys activity broadcasts 

The output would be overwhelming, but you need to look for the string android.intent.action.AIRPLANE_MODE there. You can use grep or save the output into a file and then do the search.

Look for that string under Historical Broadcast Background. You would find the timestamp you're looking for. It could look like this:


Historical Broadcast background #345:
    BroadcastRecord{48eb128 u-1 android.intent.action.AIRPLANE_MODE} to user -1
    Intent { act=android.intent.action.AIRPLANE_MODE flg=0x10 (has extras) }
      extras: Bundle[{state=true}]
    caller=android 1298:system/1000 pid=1298 uid=1000
    enqueueClockTime=2019-01-10 00:00:01 dispatchClockTime=2019-01-10 00:00:01

You can also look under Historical Broadcasts summary (background).

#15: act=android.intent.action.AIRPLANE_MODE flg=0x10 (has extras)
    0 dispatch +1ms finish
    enq=2019-01-10 00:19:14 disp=2019-01-10 00:19:14 fin=2019-01-10 00:19:14
    extras: Bundle[{state=false}]

state=true means Airplane mode was activated. state=false means it was deactivated.

All of this may seem like a trouble, so I suggest you use an automation app to listen to the intent for Airplane mode and take an action for you for convenience.

Both Tasker and MacroDroid should be able to help with this. In MacroDroid,

Trigger: Intent Received First:

  • Action: android.intent.action.AIRPLANE_MODE
    • Intent Extra:
      • Extra name: state
      • Extra value to match: true

Actions: do what you want with that

Constraints: none

Save this. Now clone this, configure the trigger and change the value for state to false. So you would have triggers for both states of Airplane mode.

  • Super answer, thank you! This would be the only way to do it I guess, i.e. there's no "app for it"? :) – z8080 Jan 9 at 20:24
  • 1
    I would have saved myself the trouble if I knew such an app. :D – Firelord Jan 9 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.