Display notification whenever app is running or not

后端 未结 2 1214
清歌不尽
清歌不尽 2021-01-27 10:53

In my program, notification must be activated whenever app is running or not. Should I put my notification method in onCreate()? my notification is just like alarm. Please check

相关标签:
2条回答
  • 2021-01-27 11:32

    Use AlarmManager with BroadcastReceiver. Using alarm manager trigger the receiver and inside your receiver class have your notification method. BroadcastReceiver allows you to run processes in background whether is app is running or not.

    0 讨论(0)
  • 2021-01-27 11:52

    Use AlarmManger to notify at specific intervals.

    Check this :

    Alaram Manager Description and Alarm Manager Example

    Hope this helps.

    0 讨论(0)
提交回复
热议问题