Execute Script on Boot Android Things

本秂侑毒 提交于 2019-12-13 04:11:05

问题


I am developing with raspberry pi3 on Android Things. I am trying to execute a Script on boot, modifying init.rc file as so:

sys.boot_completed = 1:

on property: sys.boot_completed = 1

bootchart stop

# WLD 201805031702

chmod +x /system/bin/myScript.sh //Added by me

sh /system/bin/myScript.sh      //Added by me

I don't know why, but the Script doesn't get execute, i have tried to change "hostname anyName" instead of executing the Script on these lines of init.rc file, and it does pass throw these lines because hostname get changes, but it doesn't execute the Script. How can i execute a Script on Boot, i don't know what to do.

Best regards

Alvaro


回答1:


With Android Things, you can set up your application so that it fits within the Android framework.

For example, if you use the HOME intent filter on your main activity in your app, then your activity will launch immediately on boot, allowing you to run some code.



来源:https://stackoverflow.com/questions/51374725/execute-script-on-boot-android-things

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!