顯示具有 Android 標籤的文章。 顯示所有文章
顯示具有 Android 標籤的文章。 顯示所有文章

2017-01-11

Android, ADB push & pull file.

PUSH / PC to Android
Copy file from PC to Android through ADB shell.
    Syntax | PC C:\ADB\adb push  source_PC_filePath  destination_Android_ filePath
    example: adb push w200b\02-video\color2-green.mp4 data/worktmp

PULL / Android to PC
Copy file from Android to PC through ADB shell.
    Syntax | PC C:\ADB\adb pull source_Android_filePath destination_PC_filePath
    example: adb pull data/worktmp/SoundRecord.png w200b

2017-01-04

Android, NFC.

Turn ON NFC
# service call nfc 6

Turn OFF NFC
# service call nfc 5

Turn ON Anntenna ( Default is ON )
# echo 177 > /sys/class/gpio/export
# echo out > /sys/class/gpio/gpio177/direction

NFC test
# logcat BrcmNfcJni:D | grep 'nfc type='
(nfc tag碰觸,console 會出現以下, 或類似關鍵字出現)
D/BrcmNfcJni(  595): NfcTag::discoverTechnologies (activation): index=0; tech=1; handle=1; nfc type=2

Clear NFC Log
# logcat -c

2016-12-28

Android, Bluetooth.

04. Bluetooth config file.
# cat /data/misc/bluetooth/bt_config.xml

03. Get Bluetooth MAC.
# adb shell settings get secure bluetooth_address
or # settings get secure bluetooth_address
or # service call bluetooth_manager 10  (10 for Android 4, and 12 for Android 5)

02. Get Bluetooth connection via ADB.
# adb shell am start -a android.bluetooth.adapter.action.STATE_CHANGED

01- Turn ON/OFF Bluetooth via ADB.
Turn ON Bluetooth way 1.
step-1
# am start -a android.bluetooth.adapter.action.REQUEST_ENABLE
(but it required user to accept a dialog)

step-2 (dialog pop-up)
# input keyevent 22 & input keyevent 22

step-3
# input keyevent 23

Turn ON Bluetooth way 2.
# service call bluetooth_manager 6
(and no any accept dialog)

Turn OFF Bluetooth.
# service call bluetooth_manager 8

2016-10-21

Android, input keycode

Command example:  # input keyevent 03 ==> back to Home screen.

2016-04-21

Andriod one two three

1. Capture screenshot through shell command.
    # screencap -p /sdcard/screen.png

2. am [Activity Manager]
    ==> Active default browser and go to "google" directly.
    # am start -a android.intent.action.VIEW -d http://www.google.com

    ==> Active Gallery3d to play movie file.
    # am start -n com.android.gallery3d/.app.MovieActivity -d file:////sdcard/Movies//movie.ts

    ==> Open a JPEG file.
    # am start -a android.intent.action.VIEW -d file:////data/worktmp//taiwan.jpg -t image/jpeg

    ==> Play a MP3 file.
    # am start -a android.intent.action.VIEW -d file:///data/worktmp/1kTone.mp3 -t audio/mp3

3. Shutdown
    # reboot -p
                  -p: power off
    # busybox poweroff
    # am start -a android.intent.action.ACTION_REQUEST_SHUTDOWN --ez KEY_CONFIRM true --activity-clear-task

4. Reset to factory default.
    # am broadcast -a android.intent.action.MASTER_CLEAR