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.
Asked
Active
Viewed 139 times
-1
-
Why don't you use job scheduler? – ankushalg Nov 26 '18 at 15:03
-
check this may be helpful for you : https://stackoverflow.com/questions/46511807/run-service-on-incoming-sms-in-android-oreo – ankushalg Nov 26 '18 at 15:04
-
@Ankush wont this service get killed as soon as user kills/removes the app from the task? specialy in Oreo? – Maximus Nov 26 '18 at 15:09
-
You can use job sheduler for that. Sample code for this and the methods to achieve it are documented in the below blog post. http://midhunhk.github.io/dev/2018/08/05/content-observer-service/ – ankushalg Nov 26 '18 at 15:13
1 Answers
0
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

Seungmin Ha
- 151
- 1
- 5
-
Thanks for the info, i see its mentioned at the bottom about SMS_RECEIVED_ACTION in the documentation link you've mentioned. I am accepting your answer. – Maximus Nov 26 '18 at 17:23