I'm trying to set up an alarm once a day so my user knows that he needs to check the app (extracts data from bluetooth devices, etc)
So far, I have used AlarmManager.setExactAndAllowWhileIdle(...), and a broadcastreceiver that plays some sound in the onReceive method, but this won't work when app enters App Standby.
Anyone knows how to properly set an alarm that prompts no matter if the device is in Doze or the app is in App Standby?
Related
I have my app installed in 2000 devices. In most of them it is working great. But some users (maybe 100) report me that the app is not updating correctly.
I found out that the problem is that the AlarmManager is not triggering an Alarm. The app is supposed to update data every 15 minutes so I use an Alarm Manager for that.
With no reason, it seems like it stops working after a while of running and it never starts again unless the phone is rebooted. Then it works again for a while and finishes stopping, too.
I don't have access to those devices but the users tell me they don't have any task manager or background cleaners. And in case they have them, then my app is in the 'ignore list'.
I have tried to emulate this scenario but I cannot.
It seems like the app is killed and the alarm managers don't work. By the way, those killed apps don't receive GCM events either.
So the questions are:
Is there anyway to prevent the app from being killed or to ensure the alarm is triggered at the time I set.
Can I use broadcast events like Screen-on, Screen-Off or Telephony incoming events to check if the alarm has been triggered and in case it is not to do it at that moment? I am not sure if this would work because if my app is killed then probably it will not receive any event, correct?
I want to get a notification at a specific time, say at 8am and 8pm even if my application is not running.
Application must receive notification even if OS kill my application from background due to low memory.
I don't want to use Push Notification as it will require a dedicated server which I don't have.
Is there any functionality like iOS has, where OS send notification or Silent message to application irrespective if application is in memory or it is closed/Forced stop by OS/user.
You can use AlarmManager. It has these characteristics:
... operate outside of your application, so you can use them to trigger events or actions even when your app is not running, and even if the device itself is asleep. Link to documentation
I'm making an Android app which would make the phone go on silent or in vibration mode at a user defined time.
I've learned how to toggle between silent mode to normal mode and to get the current time using calendar.
I want to know how can I turn my phone silent at a particular time even the app is not running?. Basically I want it to be like an alarm clock to make my phone silent.
create a pending intent using alarmamanager wakeup when ever you want to set up phone silent
for alarma manager check here
When an Android device receives mail, does it do this by periodically connecting to the mail server? When the device is in standby mode where the screen is off, I assume that the standard mail app also is shut down but possibly uses the AlarmManager to awake and then check the mail. I can't imagine that the mail app is always running with a full Wakelock turned on, keeping the CPU always running, as that would drain the battery.
The reason I need to know this is because my own app needs to get a notification from its own server when certain events take place. I could just as well implement a repeating alarm that activates my app periodically and checks for the notifications. But if the mail client already is waking up at a regular time interval, I probably can save on battery consumption by using e-mail to notify my app instead. For this to work though, it must be possible for the mail app to launch my app when it receives e-mail. I doubt that this is possible, or is it?
This is what you wnat to use:
Google Cloud Messaging
I am developing a reminder application. I am generating notifications using notification manager class, when the timeline crosses.But if my cell phone is switched off ,I am unable to see these notifications. Not even when i switch it on again.
Even if i switch it off and switch on again, i think the pending intents are destroyed and no notification is generated.
How do i get it when the phone is switched on again ?
Have a look at the AlarmManager:
From http://developer.android.com/reference/android/app/AlarmManager.html:
This class provides access to the system alarm services. These allow you to schedule your application to be run at some point in the future. When an alarm goes off, the Intent that had been registered for it is broadcast by the system, automatically starting the target application if it is not already running. Registered alarms are retained while the device is asleep (and can optionally wake the device up if they go off during that time), but will be cleared if it is turned off and rebooted.