0

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

Andrii Omelchenko
  • 13,183
  • 12
  • 43
  • 79
In_va2
  • 21
  • 5

1 Answers1

0

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.

Nick Felker
  • 11,536
  • 1
  • 21
  • 35
  • 1
    But in my script i need to execute some code with root permisions, because i need to mount a partition that Android thing doesnt do, so if i execute it from my app, i cant. So i need to launch a script on boot that has to be working all the time, mounting a partition when a external mass storage unit is detected. Thanks – In_va2 Jul 18 '18 at 05:57
  • @In_va2 The Android Things security model does not currently allow developers to make changes to the system at this level, or to run their apps with root privileges. We have noted the bug you filed on this issue related to mounting storage along with other similar feature request for consideration in future versions. – devunwired Jul 18 '18 at 20:30
  • and is there any library to be able to work with USB pendrives as mass storage units, manage files, copy files and so? i mean with Android things 1.0 on rpi3? – In_va2 Jul 19 '18 at 07:31