Matt Sevrens
Matt Sevrens

Reputation: 121

Using the built in alarm system, not just alarm manager

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

Upvotes: 0

Views: 1283

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007330

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.

Upvotes: 0

Related Questions