Display notification whenever app is running or not

后端 未结 2 1215
清歌不尽
清歌不尽 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.

提交回复
热议问题