I want to give notification to my app on a specific time. Say everyday i have to give notification on 7 AM even if the app is closed.
How can i do this? Any tutorial
A solution from the accepted answer will not work properly on Android 8 Oreo (api level 26) and higher due to background service limits (https://developer.android.com/about/versions/oreo/background.html#services) and will cause an exception like this when the app is in background:
java.lang.IllegalStateException: Not allowed to start service Intent xxx: app is in background
One of the possible workarounds is using JobIntentService:
extend your Service from JobIntentService instead of IntentService and use onHandleWork method instead of onHandleIntent.
add android:permission="android.permission.BIND_JOB_SERVICE" to your Service in AndroidManifest.xml.