手動啟動 Robotmon Service

進階使用:手動啟動 Service (adb指令)

  • 此步驟需要使用終端機(Terminal),請先開啟終端機
  • 進入到 Service Manager 解壓縮後 bin 資料夾下,確認 adb 執行檔存在,並且有 windows, linux, mac 資料夾
  • 取用 Service 需要確認 手機支援度
    1. 手機為 32 位元或 64 位元,確認使用 app_processapp_process32 來啟動 Java 執行程式
    2. 手機是否有 nohup 執行檔 (為了背景執行),或可用 daemonize 取代,兩者都沒有的話可能必須依賴電腦
    3. 手機 Robotmon APP 安裝 APK位置 (使用 pm 指令來取得)
  • 可以參考 Service 自動啟動器的指令(點擊兩下 Start 後會顯示啟動指令)
  • 註: $ 表示為下指令,實際操作時請刪除。# 為註解,非指令

Mac

# 進入 service-mamager/bin 資料夾
$ cd bin

# 確認電腦已經連接手機 (只能連接一支手機)
$ ./adb.darwin devices
List of devices attached
LC53DYH00494 device

# 確認 app_process32 是否存在,不存在請改用 app_process
$ ./adb.darwin shell 'ls /system/bin/app_process32'
/system/bin/app_process32

# 確認 nohup 存在,不存在請改用 daemonize,兩者都不存在,可能要依賴電腦
$ ./adb.darwin shell 'ls /system/bin/nohup; ls /system/bin/daemonize'
/system/bin/nohup
/system/bin/daemonize: No such file or directory

# 確認 apk 安裝位置,請再次確認 Robotmon App 已經安裝
$ ./adb.darwin shell 'pm path com.r2studio.robotmon'
package:/data/app/com.r2studio.robotmon-1/base.apk

# 組合啟動 Service 指令
# 上述指令目的要湊出粗體字串
# nohup sh -c "LD_LIBRARY_PATH=/system/lib:/data/data/com.r2studio.robotmon/lib:/data/app/com.r2studio.robotmon-1/lib/arm:/data/app/com.r2studio.robotmon-2/lib/arm CLASSPATH=/data/app/com.r2studio.robotmon-1/base.apk app_process32 /system/bin com.r2studio.robotmon.Main $@" > /dev/null 2> /dev/null &

$ ./adb.darwin shell 'nohup sh -c "LD_LIBRARY_PATH=/system/lib:/data/data/com.r2studio.robotmon/lib:/data/app/com.r2studio.robotmon-1/lib/arm:/data/app/com.r2studio.robotmon-2/lib/arm CLASSPATH=/data/app/com.r2studio.robotmon-1/base.apk app_process32 /system/bin com.r2studio.robotmon.Main $@" > /dev/null 2> /dev/null &'

# 確認 Service 是否啟動,啟動成功會出現類似下列訊息,第二欄位為 process id
$ ./adb.darwin shell 'ps | grep app_process'
shell     9512  9508  1570960 39576 ffffffff ecc9c570 S app_process32

# 停止 Service
$ ./adb.darwin shell 'kill 9512'

# 確認是否成功停止 Service,沒出現額外訊息表示成功停止
$ ./adb.darwin shell 'ps | grep app_process'

# 進階排除錯誤,查看 Log。如果 Service 啟動失敗,手機會出現錯誤訊息來 Debug
$ ./adb.darwin logcat

# 訊息太多可用 grep 來 filter,關鍵字為 main, GoLog...
$ ./adb.darwin logcat | grep main
$ ./adb.darwin logcat | grep GoLog

Linux

指令同 Mac,只需要把 ./adb.darwin 換成 ./adb.linux 即可

Windows

TODO


Root

`test -e /system/bin/nohup && echo /system/bin/nohup` su -c "LD_LIBRARY_PATH=/system/lib:/data/data/com.r2studio.robotmon/lib:/data/app/com.r2studio.robotmon-1/lib/arm:/data/app/com.r2studio.robotmon-2/lib/arm CLASSPATH=`pm path com.r2studio.robotmon | cut -d ':' -f 2` app_process /system/bin com.r2studio.robotmon.Main $@" > /dev/null 2> /dev/null &


Start Service on rooted NOX

0 Enable Root in settings in Nox

1 Install Termius App

2 Go to this URL (this page) https://sites.google.com/view/robotmon/%E9%80%B2%E9%9A%8E%E4%BD%BF%E7%94%A8/%E6%89%8B%E5%8B%95%E5%95%9F%E5%8B%95-service

3 Copy root command (bottom of page)

4 Paste command in Termius App and press enter

5 Service On !!