I'm developing an app which needs to send an SMS if / when the device shuts down.
In order to receive the action I'm using android.intent.action.ACTION_SHUTDOWN
and android.intent.action.QUICKBOOT_POWEROFF
actions, and it works perfectly well. In fact, the method I'm using to send the SMS is also working (as I have used it multiple times in other apps).
The problem I'm facing is that when I receive the SHUTDOWN
action the telephony service is already off, so the SMS is unable to be sent and it remains queued waiting for a retry.
Is there a way to prevent / turning on again the telephony service in order to send my SMS?
In case it's not possible, is there another action similar to the SHUTDOWN
event which I can use instead?