I am trying to execute a daemon on boot of my Nexus 5. This is a daemon built from source in c++
. But whenever I build AOSP and flash the images on my Nexus 5 device, the daemon is not running in the background. I added this code to my init.rc file: (which should make it run in the background on boot)
setenforce 0
service my_daemon /system/bin/my_daemon
class main # Also tried: class core (but it didn't make a difference)
user root
group root
setenforce 1
The reason I use setenfonce is because of SELinux on Android 5.0 and above. The problem is that on boot, the daemon is not running on boot. I don't have any clue as to why. Any suggestions?