I would like to set a normal, Android alarm clock in my app - the one in the default Android Clock application. I simply want to schedule a an alarm that will ring let's say tomorrow at 8 a.m. I've read about the Alarm Manager, but it seems to trigger an event, and I just want it to ring. I'm pretty sure there's an easy solution for that, but I couldn't find it. I'll apprecaite any help!
It appears that there is no documented Intent for launching the alarm clock in the Android SDK. Having said that, here are a few resources you can try that should get you around that:
Intent to launch the clock application on android
Android AlarmClock ACTION_SET_ALARM intent produces exception
How does one launch android version dependent alarm clock?
I ended up building my own ringer in the BroadcastReceiver, as zapl suggested (thanks!). Problem was, I couldn't create a dialog that would allow user to dismiss the alarm, however I was able to create a notification that does that, as the class documentation suggested.
Related
In the last year I have bought 4 different Android phones and all of them had got failures with the calendar notifications. Sometimes the notification for an event was shown and sometimes wasn't shown at all. I investigated a lot and found a problem in the "Calendar Storage" app, a Content Provider that is in the application framework layer. Notifications stop to be always shown as of the version 6.0.1. That's the reason why I want to develop my own calendar app that is not based on the Calendar Provider so that I can have reliable notifications again.
In the past, when we developed a reminder based app we used AlarmManager class and the method setExact() for make the application able to show a notification or anything else at a given date and time in the future. But in Marshmallow and upper it mustn't work because of the annoying doze mode.
They invented the method setExactAndAllowWhileIdle() in Marshmallow supposedly for setting alarms that can bypass the doze mode. But it says that it doesn't let you to put more than one alarm within 15 minutes. In a reminder based app that is a foolishness as the user MUST be able to put as many reminders as he wants and as close in the time line as he wants.
So my question is, how can I make my app to show reminder notifications at a given time in a way that always works regardless of the doze mode and so that I can have as many notifications as I want and as close in time as I want?
Thank you.
There's always the option of white listing your app so doze will still let it run the old way.
Another official way of making it work is sending an fcm notification, but you'd need a server to do the job.
Short from that I'm afraid the next official answer involves exact alarms.
If it's an option for you there is a chance you can start a service with STICKY. I'd expect the phone to never go into doze properly even if the service thread is blocked forever (it may help to assign it to a different process in the manifest so your ui never freezes). Putting a periodic old style Java timer to fire a callback at the right time may accomplish what you need.
I'm new to Ionic and building an alarm app.
How do I set an alarm and have it survive reboot?
How does the alarm activate the app to a certain ui state?
I found this, but it has this problem
This looked promising, but I didn't see an alarm function.
These two Cordova plugins looked promising, but they don't support IOS.
What's the best strategy? Thanks!
On iOS there is no way to open your app out of the blue without the user's doing it manually (or calling it from another app). -Unless you are creating a jailbroken app
The closest you can get is to set a Local Notification to pop up at the time that your alarm is supposed to go off. It will trigger a Push-like Notification that should be reboot persistent. Once it popped, if the user decides to tap on it, it will open your app.
I am building an alarm clock app for android as my first go at an app. All my activities, views and a nice ui are ready.
My problem is that I just can't decide which is the best way to start each alarm.
As far as I can see, I have two options:
Option 1 - I can use android's built in AlarmManager to manage the alarm.
But if I do so, then how can I store the different alarm types?
What I mean is: there are four alarm types in my app: Standard, math, puzzle anf bar code scanner.
So, when the alarm goes off, I need it to know which dismiss activity to show.
My biggest worry is that I have been reading that some manufacturers disable the built in alarm manager such as HTC and a few others.
Option 2 - Store all the alarms in a database that my app will create, and have my app permanently running in the background.
But I feel this is excessive and wil use to many resources.
Can anyone Point me in the right direction? I want the app to work perfectly on every device.
Option 1 . I can use androids built in alarm manager to manage the alarm
This is the only sensible solution.
But if I do this then how can I store the different alarn types
Have an extra in the Intent in your PendingIntent for AlarmManager that indicates what specifically should be done when the alarm goes off.
My biggest worry is that I have been reading that some manufatures disable the built in alarm manager such as HTC and a frw others.
I am not aware of HTC messing with AlarmManager -- if you have a link to that, I'd love to see it. SONY, when the device is in STAMINA mode, will treat _WAKEUP alarms the same as their non-_WAKEUP counterparts. However, the user has to opt into STAMINA mode and can add apps to a whitelist to be left alone.
Store all the alarms in a database that my app will create and have my app permanently running in the background
Since your app cannot be permanently running in the background, this will not work well.
I would like to know if there is a way to programmatically create an alarm clock event? I know with API 9, you can use the AlarmClock class set parameters and then pass them to the activity, but I would like to mimic this same action inside my app, without pulling up this activity.
You can still use the AlarmClock API. If you want to skip bringing up the AlarmClock activity add this extra:
i.putExtra(AlarmClock.EXTRA_SKIP_UI, true);
Though I have experienced a known Android issue where this extra causes the alarm to be created and saved, but it doesn't arm correctly (it won't ring go off when the time comes even though it appears as on). The work around we found for this issue was to call startActivity() twice. Thus far it has been working perfectly.
In Android, how to turn on and turn off my alarm clock, using Android SDK ?
Thanks.
I'm not sure you can directly turn it off and on, but it sounds like you can cancel an alarm using an Intent. You can also set one. I assume it would just pop up the alarm dialog, which would allow the user to cancel it.
See AlarmManager for relevant cancel and set methods.
Also, here is an example that walks through an alarm service, using the AlarmManager.
Go to Clock in the Menu of SDK...
Then,
on the left bottom,..there is a Alarm Symbol...click it..
It will display all the alarms already fixed and a link to fix a new alarm..
Select the Alarm that you want to reset...there is option very first to on/off your alarm...this is how it works...