Open sudipta1411 opened 2 years ago
Turns out that one needs to disable battery optimization feature in certain mobiles. Now my code is working. But I still do not understand why Telephony is working in the same mobile without disabling battery optimization.
I am trying to implement call listen in the background feature in order to learn flutter. My code is based on your project. The code is working when I minimize the app (the app is not in foreground). However when the app is killed, it does not work. My initial guess is that the
BroadcastReceiver
is not alive when I kill the app. Based on your code I am not sure what I am doing wrong. How are you keeping theIncomingSmsReceiver
alive after the app is killed? I have asked https://stackoverflow.com/questions/72402844/issue-running-a-background-task-in-android-when-the-app-is-killed . It would be nice to have your feedback. Do I need to add some permission to the receiver?This is not an issue per se, but there is not much documentation available on the web. It would be great if you kindly give me some pointer before closing the issue. Thanks.
P.S. I did some more digging. It turns out that when I close my app, the
IncomingSmsReceiver
runs is a diiferent process, as evident from the following log fromadb logcat
:This happens only when I close my app (not when the app is in background). Can you please explain this? Thanks