Reset alarm with Alarm Manager after force stop the application - android

I followed this post http://it-ride.blogspot.com/2010/10/android-implementing-notification.html to implement a Notification Service. It uses AlarmManager and Wakelock to start a service. When you restart the device the alarm is set correctly or when you open the app the alarm is set, but if you force close the app the alarm is gone. I would like to reset the alarm after the app is forced stopped. How can I do this?

According to Google's Android engineers, an app that is forcefully stopped will not start again until the user invokes it.
Check out the following response found here.

Related

Android AlarmManager is cancelling alarm when app is dead after fresh install of app on device

I have made an alarm clock app that uses AlarmManager to place alarms. There is a broadcast receiver that receives the alarm broadcast, and then starts a foreground service.
Consider this situation: I do a fresh installation of my app on a device and add an alarm. I let a few seconds pass by, open a terminal window, and type the following command: adb shell dumpsys alarm. In the list, I can find the alarm registered by my app.
Now, I close the app (clear it from recents), make sure the alarm process is dead from Android Studio logcat, and again type the above command. I cannot find my alarm in the list! The alarm was there just a few seconds back, and now it is not there.
So I open the app again, delete this alarm, and add another alarm. With dumpsys, I can find my alarm in the list. I close my app and again execute dumpsys, only to find that this time, my alarm is there in the list. When the time arrives, the foreground service starts properly.
Why is the alarm getting cancelled after I close the app in case of a fresh installation?

Android: Right approach in scheduling a new alarm on upgrade

I have an application already in the Play Store. Now, I am going to release an upgrade as part of which a new alarm has to be scheduled. A little context into the alarm:
When a user installs an app and logs in, this alarm gets scheduled for periodic background sync.
However how will I start this alarm for users who have already installed my app and are logged in? Alarm will eventually get started on next reboot but I would like to understand what is the right approach when trying to start an alarm immediately after an upgrade.
You could use a broadcast receiver and catch the Intent.ACTION_PACKAGE_REPLACED action to get this done.
example code can be found at http://alvinalexander.com/java/jwarehouse/android/core/java/com/android/internal/content/PackageMonitor.java.shtml

After force stop, next notification not triggered in android phonegap

I am using local notification plugin in my application. Here i set notification like alarm. Its working fine. what ever time i set in my database, alarms are working fine.
But while i force stop the application(Setting->Applications->Manage applications->MyApplication->ForceStop), next alarm is not coming. any one can help me?.. i tried with following link,
http://www.javacodegeeks.com/2012/05/android-broadcast-receiver-change-in.html
but still is not working.
force stop app will remove alarm associated with the app
so your pending task will never be done.
read in details:
http://blog.csdn.net/gemmem/article/details/8858461

android AlarmManager behavior when application is forced to close

I use AlarmManager to issue local notifications to user. But if I kill my application using Settings->Apps->Stop, alarm manager seems to be destroyed and all the notification icons disappears from status bar.
It it normal? The idea of local notifications is to persuade user to start my great app if it's closed. And it seems odd for me that they are being wiped out if I kill the app.
If you KILL your application you also kill the AlarmManager.
There is nothing odd about it. You close the app by pressing the home button, not by killing it via the settings.
Use service to set AlarmManager and notification.
Also keep in mind that once device is restarted Alarm is cancelled.
So you will need to set broadcast receiver.
look at this Click here

Alarm in the AlarmManager get erased when process is killed

I'm a newbie in android so please bear with me.
My Main activity creates and alarm in the alarm manager which supposed to fire in specific time, my main Activity also create Broadcast receiver which suppose to receive the Intent that the alarm fired, everything is working good until Task manager killing my App.
I've check the PendingIntent list in the AlarmManager and verify that my alarm is getting erased from the Alarm Manager, I try to add service and register alarm from the service, I've red that maybe because my IntentFilter of the Broadcast receiver is defined in code and not in manifest it get killed after app process is killed, and I'm stuck on this issue for two weeks :-(, with big confuse, my design is wrong ?
Here is my needs:
That the alarm will be very reliable, even if app is killed or even if phone is restart.
Same goes to the broadcast receiver.
Thank you in advance,
If the user task-kills or force-stops your application, your alarms are unregistered. And, on Android 3.1+, nothing of your app will run again until the user manually launches one of your activities.
There is nothing that you can do about this, other than to do your best to write a high-quality application that the user will have no need or wish to force-stop.

Categories

Resources