I'm a C++ developer and developing my first Android application. My application is an special kind of Reminder. I'm looking for the best way to do it. I have tried this approaches:
- Use a Service
- Use an AlarmManager
My question is that can I use AlarmManager singly? Is it a CPU time consuming task considering that my AlarmManager should be fired every 1 second ? (It seems that every time an AlarmManager is executed a new process except main process is created and immediately is killed).
If I use a service then my application should always stay in memory and also what happens if is killed by user !?
How Android Alarms (default installed application) works?
Any help would be appreciated.
Use a Service that returns START_STICKY and make it startForeground, this way your app will run all the time even if System kills it for resources after a while it'll be up and running again normally, and about user killing it well this is something even big apps complain about like Whatsapp as u see in the wornings when installing whatsapp first time. here is an example of how the service should be like:
this is the best recipe for ongoing service to execute your codes.