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
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.
Use AlarmManger to notify at specific intervals.
Check this :
Alaram Manager Description and Alarm Manager Example
Hope this helps.