简体   繁体   English

在启动Android Things上执行脚本

[英]Execute Script on Boot Android Things

I am developing with raspberry pi3 on Android Things. 我正在Android Things上使用树莓派pi3开发。 I am trying to execute a Script on boot, modifying init.rc file as so: 我试图在启动时执行脚本,将init.rc文件修改为:

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. 我不知道为什么,但是脚本无法执行,我尝试更改“主机名anyName”,而不是在init.rc文件的这些行上执行脚本,并且由于主机名得到了更改,它确实通过了这些行,但它不执行脚本。 How can i execute a Script on Boot, i don't know what to do. 我如何在启动时执行脚本,我不知道该怎么办。

Best regards 最好的祝福

Alvaro 阿尔瓦罗

With Android Things, you can set up your application so that it fits within the Android framework. 使用Android Things,您可以设置应用程序,使其适合Android框架。

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. 例如,如果您对应用程序中的主要活动使用HOME意图过滤器,那么活动将在启动时立即启动,从而允许您运行一些代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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