Search code examples
androidandroid-studiobroadcastreceiverandroid-8.0-oreo

How to use broadcast receiver to get alerted/notified when SMS arrives in Android oreo?


I know broadcast receiver wont work when app is killed in oreo, but i want to get sms data when app is killed. How do i do that? Is there any way to achieve this? Oreo has been a sort of headache.


Solution

  • On Oreo, you can receive broadcast receiver for sms even if application isn't on memory as you mentioned it by 'killed'.

    As you said, from android oreo, the broadcast receiver can't receive implicit intent even if it is defined on android manifest.

    But sms receive is a whitelisted so you can receive it even if you application isn't on memory.

    Please check below link.

    https://developer.android.com/guide/components/broadcast-exceptions