How to automatically start native apps when booting Android system

Hello.

I want the software (native application) generated by the Android NDK to start automatically when Android starts (without running the ADB command, that is, without connecting the USB cable). It was successful with DragonBoard410C (Android 6.1). However, it fails with the Open-Q410SoM DevKit (Intrinsyc Technologies) with the same 96Boards specifications as the DragonBoard410C. If you have any ideas I should try, please give me some advice.

==========

Below are the steps that were successful with the DragonBoard 410C.

  1. C programing
    I programmed in C, and I generated a native app(tentatively named “sampleExe”) with Android NDK.

  2. Installation
    I installed it in ”/ system/bin/" directory using the ADB command.

    adb root
    adb remount
    adb push sampleExe /system/bin/.
    adb chmod 755 /system/bin/freely_0

3)Test execution with ADB command

This software drives various sensors by I2C communication, UART communication, or GPIO control. So,full execution requires root privileges.

adb root
adb shell /system/bin/sampleExe

This worked fine.

It’s annoying to have to connect a USB cable and command with ADB every time, so power on the DragonBoard410C and auto run “sampleExe” as soon as the Android system booting. This could be achieved in the following ways:

4)Write a shell script that calls a native app

The contents of the shell script are as follows:

#!/system/bin/sh
su 0 /system/bin/sampleExe

Add this shell script file “run_sample” under /system/bin/

adb root
adb remount
adb push run_sample /system/bin/.

5)Set to run at Android boot

I added it to the following sentence at the end of the “/etc/init.qcom.post_boot.sh” that is called when the system boots.

run_sample

By these procedures, “sampleExe” now works automatically when the DragonBoard410C is power on.

However, when I tried to do exactly the same method with Intrinsyc’s Open-Q410SoMDevKit, which has the same 96Boards specifications as DragonBoard, it didn’t work. Although there are differences between Android 6 and Android 7, the soft behavior at system startup looks the same.

After all, on 96Boards (DragonBoard410C, Open-Q410 SoM Devkit) with Android as the OS, I know a surefire way to automatically run a native APP generated by the Android NDK right after the Android system is booted.

thank you.