I'd like to know if it's possible to send a local notification to the device when the app have been opened then closed.
It works already when my app is opened and when it's in the background.
Thanks
Edit : I think i wasn't clear enough:
I want to send a local notification at a given time even if the app is not running at that time.
you need to create a service, http://developer.android.com/guide/components/services.html
I hope you can tackle it using the function
public void onTaskRemoved(Intent rootIntent) {}
Most means of "killed the process of [your] app" will leave your alarms intact, and so whatever you have scheduled will remain scheduled and keep being invoked as you set up.
Again,
AlarmManager
is not dependent upon your process being around, so long as it can invoke thePendingIntent
that you supply. So long as theBroadcastReceiver
you are using is registered in the manifest (and not viaregisterReceiver()
), it should work fine.If the user force-stops your app -- usually via the Settings app -- then not only will your alarms not be invoked, but your code will never run again, until something explicitly starts up your app (usually the user tapping on your icon in the launcher). There is nothing that you can do about this.
There are many Android developer support sites, offering a variety of languages.