简体   繁体   中英

Bluetooth Enable Disable ADB command and Opening Android Activity with Android Driver not working in Some Android 7 devices

Result: Parcel(
  0x00000000: ffffffff 0000006e 0065004e 00640065 '....n...N.e.e.d.'
  0x00000010: 00420020 0055004c 00540045 004f004f ' .B.L.U.E.T.O.O.'
  0x00000020: 00480054 00410020 004d0044 004e0049 'T.H. .A.D.M.I.N.'
  0x00000030: 00700020 00720065 0069006d 00730073 ' .p.e.r.m.i.s.s.'
  0x00000040: 006f0069 003a006e 004e0020 00690065 'i.o.n.:. .N.e.i.'
  0x00000050: 00680074 00720065 00750020 00650073 't.h.e.r. .u.s.e.'
  0x00000060: 00200072 00300032 00300030 006e0020 'r. .2.0.0.0. .n.'
  0x00000070: 0072006f 00630020 00720075 00650072 'o.r. .c.u.r.r.e.'
  0x00000080: 0074006e 00700020 006f0072 00650063 'n.t. .p.r.o.c.e.'
  0x00000090: 00730073 00680020 00730061 00610020 's.s. .h.a.s. .a.'
  0x000000a0: 0064006e 006f0072 00640069 0070002e 'n.d.r.o.i.d...p.'
  0x000000b0: 00720065 0069006d 00730073 006f0069 'e.r.m.i.s.s.i.o.'
  0x000000c0: 002e006e 004c0042 00450055 004f0054 'n...B.L.U.E.T.O.'
  0x000000d0: 0054004f 005f0048 00440041 0049004d 'O.T.H._.A.D.M.I.'
  0x000000e0: 002e004e 00000000                   'N.......        ')

While running the following ADB Command, the above error thrown in CLI.

Enable:

adb shell service call bluetooth_manager 6

Disable:

adb shell service call bluetooth_manager 9

Also tried with the appium android driver activity, Nearly the same permission issue in Samsung Galaxy Note 8 (7.1.1), Samsung Galaxy Note 2 (7.0). But both activity and ADB command works fine in Samsung Galaxy S7 edge (7.0).

Android driver activity error:

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Error occured while starting App. Original error: Error executing adbExec. Original error: 'Command '/home/user/Android/Sdk/platform-tools/adb -P 5037 -s 83f0374b42535532 shell am start -W -n com.android.settings/com.android.settings.bluetooth.BluetoothSettings -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000' exited with code 1'; Stderr: 'java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.settings/.bluetooth.BluetoothSettings launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 } } from null (pid=24744, uid=2000) requires android.permission.BLUETOOTH_ADMIN
    at android.os.Parcel.readException(Parcel.java:1693)
    at android.os.Parcel.readException(Parcel.java:1646)
    at android.app.ActivityManagerProxy.startActivityAndWait(ActivityManagerNative.java:3646)
    at com.android.commands.am.Am.runStart(Am.java:658)
    at com.android.commands.am.Am.onRun(Am.java:392)
    at com.android.internal.os.BaseCommand.run(BaseCommand.java:51)
    at com.android.commands.am.Am.main(Am.java:125)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:301)'; Code: '1' (WARNING: The server did not provide any stacktrace information)

Any solutions would be appreciated.

the problem that you had faced because that you run your command without root permission.

run this command if your phone is already rooted:

adb root

after:

adb shell service call bluetooth_manager 6

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM