Create Alarm Clock Alarm Android - android

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.

Related

How to handle a click on the clock in the settings pane in Oreo+?

I'm trying to handle a click event on the clock on the Settings Pane. I'm sort of confused on the terminology which isn't helping, but here's a screenshot:
I've got an app that I'm developing (If you're curious it's here: https://play.google.com/store/apps/details?id=com.fric.beethovenalarmclock&hl=en)
Anyhow, I'm really not sure what the button does. The default behavior seems to create a new alarm using the stock Google alarm clock. When I set an alarm on my app, though, it launches the intent for the wake screen. I'd like to be able to choose which activity in my app to launch, depending on whether sound is playing, or an alarm is set.
I couldn't find any documentation anywhere on what this button is or how to handle a click on it.
Thanks in advance!

how to activate the activity in android app in the right time that the app should be closed then

I am working on alarm clock android app.
my problem is to activate an ringing activity in the app at the right time that the app should be closed then..
how to do that??
I wish my idea is clear. thanks
You can use AlarmManager to set the alarm. You just need to create a PendingIntent for the activity, and then pass in the parameters for either AlarmManager#set or AlarmManager#setExact, depending on your API version. If you are using API 21 or later, another option is AlarmManager#setAlarmClock.

best way to build an android alarm clock

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.

Android app autostart

I'm working on an Android application, and I want it to get started right after the phone boots up. I used BroadcastReceiver, and the intent filter boot up complete, and the permission, and I think it's working; I turn on the phone, it boots up, and then it shows the main menu, and after 30 seconds or so, my app starts. Is that the normal behaviour for it? I would like it to start right away, without even showing the main menu first. Is that possible? or is this the best i can get? I didn't find anything about this issue in google, and I'm relatively new to Android so I'm not sure if that's the normal behaviour or not. Hope you can help me, thanks.
It sounds like what you are looking for is a Service. It will run in the background and can be set to auto start. I'm not sure that it necessarily come up faster than your activity does, but I think it will. Check these documents: http://developer.android.com/guide/components/services.html

Android - How to set system Alarm Clock from my own app

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.

Categories

Resources