Turning airplane mode on via ADB

后端 未结 15 1609
暖寄归人
暖寄归人 2020-12-01 06:43

I\'ve looked all over and I haven\'t found a concrete answer to this question. I\'m hoping to find a way to toggle airplane mode from ADB that doesn\'t involve the GUI in an

相关标签:
15条回答
  • 2020-12-01 07:18

    only worked on Rooted device..

    turn onAirplane mode :

    adb shell -c settings put global airplane_mode_on 1
    adb shell -c am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true
    

    turn off Airplane mode :

    adb shell -c settings put global airplane_mode_on 0
    adb shell -c am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false
    
    0 讨论(0)
  • 2020-12-01 07:19

    For newer android this en/disables wifi. Not quite your task, but i would've been happy to find it here:

    adb shell svc wifi disable
    

    or

    adb shell svc wifi enable
    

    Credit goes to this answer: https://stackoverflow.com/a/27228962/1021872

    0 讨论(0)
  • 2020-12-01 07:19

    In my .zshrc file I added this to simulate airplane mode.

    alias android:online="androidOfflineOnline enable"
    alias android:offline="androidOfflineOnline disable"
    function androidOfflineOnline {
       adb shell svc data $1
       adb shell svc wifi $1
    }
    
    0 讨论(0)
  • 2020-12-01 07:19

    If the phone is rooted then you can use this command. Also if using Magisk, shell must be given "su" permission

    Enable flight mode

    adb -s ZY32234G3V shell "su -c 'input keyevent KEYCODE_WAKEUP;input keyevent KEYCODE_MOVE_HOME;settings put global airplane_mode_on 1;am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true'"

    Disable flight mode

    adb -s ZY32234G3V shell "su -c 'input keyevent KEYCODE_WAKEUP;input keyevent KEYCODE_MOVE_HOME;settings put global airplane_mode_on 0;am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false'"

    0 讨论(0)
  • 2020-12-01 07:21
    adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS
    adb shell input keyevent 19 & adb shell input keyevent 23
    
    0 讨论(0)
  • 2020-12-01 07:21

    Use the following command to launch Settings > Wireless networks, toggle Airplane mode and return (by pressing Back):

    • Windows/DOS: adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS & adb shell input keyevent 19 & adb shell input keyevent 23 & adb shell input keyevent 4
    • Unix/Linux: adb shell am start -a android.settings.AIRPLANE_MODE_SETTINGS ; adb shell input keyevent 19 ; adb shell input keyevent 23 ; adb shell input keyevent 4

    Tested on Samsung Galaxy S (Android OS 2.3.3).

    0 讨论(0)
提交回复
热议问题