I want to implement a service which should be running like standard system service on boot up, this service should not be kill-able and should be able to perform action on receiving notification from another process.
Can anyone help me which is the best methodology (AIDL) to create such service,if any example for reference ?
You can’t do this unless you are creating your own system ROM.
If creating your own ROM, you can start by modifying the AndroidManifest of the apk containing your service. You need to add an attribute to your
manifestnode:android:sharedUserId="android.uid.system". That will cause your APK to hold the system ID (which requires the APK to be signed with your platform signing key — this is why you need to be creating your own system ROM.That will allow your application to be considered special by the system, and (at least on 4.x, I haven’t tested on older Android versions) your application will be auto-started. The application being auto-started doesn’t mean much on its own though; either you need to implement a BOOT_COMPLETED receiver as @febinkk suggests, or you can provide a custom Application override (by adding the attribute
android:name="your.package.ApplicationSuperClass"to yourapplicationnode in your AndroidManifest.xml). In your application super class, you can overloadonCreate()and have it start your service or whatever else is required.Additionally, as a system application, I believe (though have not fully tested) you will not be able to be killed through normal means.