I writing something that schedules events at various time. Right now I just create a pendingintent and use the alarm manager to call a broadcast receiver at a specific time. This then calls a transparent activity with a dialog box and runs vibration/ a media player to mimic an alarm clock. One of the problems with this, is that then the alarm is privy to the media volume settings rather than the alarm volume settings.
Another problem is, I'd like users to be able to see the alarm amongst the system alarms. I would imagine this has something to do with it http://developer.android.com/reference/android/provider/AlarmClock.html
But it doesn't seem like you have control over things like ringtone, vibration pattern, volume etc. At the very least I'd like to play an alarm sound which volume is not affected by the media volume levels.
What is the best solution here for creating an alarm that really mimics the system and feels to be integrated with android very well? I'm stumped as every search I do just brings up info about alarmmanager
One of the problems with this, is that then the alarm is privy to the media volume settings rather than the alarm volume settings.
You can tell MediaPlayer what volume stream to use.
But it doesn't seem like you have control over things like ringtone, vibration pattern, volume etc.
Correct. The AlarmClock ContentProvider is providing data for the device's built-in AlarmClock application. It is not providing data for you.
At the very least I'd like to play an alarm sound which volume is not affected by the media volume levels.
You can tell MediaPlayer what volume stream to use.
What is the best solution here for creating an alarm that really mimics the system and feels to be integrated with android very well?
The user is perfectly capable of using the device's built-in AlarmClock application for this.
Related
I am building a reminder app and need to implement repeating alarms. Following the Android documentation on the topic everything runs okay except that:
Phone does not wake up if locked.
Phone won't ring.
When setting a regular alarm, the phone would ring (but never wake up). I would like to solve these two issues for repeating alarms. I'm on API 29.
Thanks in advance!
Hello, I am having trouble figuring out the best way to make an alarm clock noise for my alarm clock app. I want to start the noise when the broadcast receiver is activated. I am able to create a media player, but the noise is attached to the media volume. I am not sure how to tie the noise to the alarm volume like google clocks. See image please, or at least the notification volume. I don't want it to run off media volume in case someone has it low, and makes the alarm pointless.
My app needs to wake the user up in the night so I would like to access the device's clock alarm and add my own in there. The alarm times shifts throughout the month, so I would need to access it and update it.
For example, I would like to add a daily alarm in the device clock alarm. Then everyday, I would like to run some calculation and adjust the time for the daily alarm.
Is this possible? I found AlarmManager but this seems like a scheduler not the device clock alarm. Perhaps there is an intent for the clock alarm? The screenshot below is the setting I am trying to access from my app (without rooting the device).
Here you have a tutorial about programming alarms for Android.
https://developer.android.com/training/scheduling/alarms.html
The thing is that is not needed to access the native clock app to set them, you can do it with your own app.
Be aware that this will not program an "Alarm"(with music and so on), it will only provide you the possibility to shcedule some task. In your case this task could be wake up the user with a loud music or whatever.
I want to create my alarm app.
but, I don't want to re-design a new alarm clock function.
so, I want to use android built-in alarm clock.
what I want the procedure is:
use android built-in alarm clock to set the time.
when the alarm is ring, my alarm app will be launched to replace built-in one.
use my alarm app to dismiss the alarm.
How could I make it?
Thank you so much.
How could I make it?
You can't. The only thing an SDK app can do with respect to the device's own alarm clock app is to display an activity to allow the user to set the alarm, with a filled-in set of values.
I'm writing an alarm-based application, and I'm looking for a way to wake up the user insistently. Ideally, I'd like the phone to vibrate, ring, and display a message. I tried a few different options, here's what I have for the moment:
Have the background service start an activity that vibrates & plays music.
problem: even with a WAKE_LOCK, it seems that the user still has to turn on the screen and unlock it to see my activity
Use the AlarmManager with RTC_WAKEUP and a broadcast receiver to start the aforementioned activity
same issue
Simply pop up a notification, which the user can click to see the activity
problem: stil the same issue, and also I can't get the notification to vibrate and ring, and repeat often until dismissed
What I would really like is to have a behaviour similar to the basic Android morning alarm, or similar to receiving a phone call: regardless of whether your phone is awake or sleeping, it rings, vibrates and displays information such as a message, a photo...
Any tips on the direction to use would be greatly appreciated! I'm sure I've seen alarm apps or "fake phone call" apps do something similar, but I'm out of ideas.
Cheers
ps: in the context of this application, I think it would be reasonable to wake up the user this way. A discreet notification would not be appropriate - unless you can wake up to a single vibration :)
Have you looked at the ACQUIRE_CAUSES_WAKEUP flag? It looks like it should do what you want. See here for more information: http://developer.android.com/reference/android/os/PowerManager.html