[Solved] Android: How can I send an SMS in the background? (API Min is 21)


Like @CommonsWare said, you need to handle your specific time logic. Why not use an AlarmManager which will call a Service in which your code for sending the sms actually “happens”. If you do use an AlarmManager, please note that different versions of Android will (likely) be handled by different methods related to AlarmManager, possibly including code to reset the AlarmManager (if necessary). You also have to be aware of changes to how Services are managed in “the background” from Marshmallow on….

**EDIT: ** Please be aware that when rebooting your device you will have to reset your AlarmManager as well.

1

solved Android: How can I send an SMS in the background? (API Min is 21)