I want to make it a service which runs on start/reboot and keeps running in background.
Not possible in any modern version of Android – it needs to be a foreground service. That said, the
SMS_RECEIVED action is exempt from the restrictions around implicit broadcasts, so you should be able to just define it in your manifest only. No need for your boot receiver or service. Just use your
Keep in mind that you’ll need to account for dynamic permissions as well. Specifying the
RECEIVE_SMS permission in your manifest isn’t enough; you’ll also need to add code to prompt for the permission if the user hasn’t allowed it.
You can enable the permission manually from the settings page for your app, or add the
-g flag if you install your app via ADB.
CLICK HERE to find out more related problems solutions.