alarm

Why is my AlarmManager firing off instantly?

流过昼夜 提交于 2019-12-06 03:48:38
I'm trying to build an alarm application. I had the alarm working before and I was able to set the different times and the alarm would go off appropriately. I then changed the layout of the ChangeAlarmActivity to a TableLayout and now it won't work? I didn't touch the code. Here is how I set the alarm: Intent alarmIntent = new Intent(ChangeAlarmActivity.this, AlarmReceiver.class); PendingIntent pendingAlarmIntent = PendingIntent.getBroadcast(ChangeAlarmActivity.this, (int)alarm.getID(), alarmIntent, 0); AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE); System.out

Can android developers access the system clock/alarm application?

北城余情 提交于 2019-12-06 00:09:17
My Nexus S comes with a default clock application where I can set an alarm. When I set an alarm then I see a little clock in my status bar. If I go to 'Manage Applications' or 'Running Services', I would expect to see Clock there, but I don't? If I go to 'All' from 'Manage Applications', then I do see the Clock app, and I can Force Quit it, however the clock in the status bar still appears. If the default Clock application never appears in Running Applications or Services because it is part of the system, then can developers access this Clock app? For instance I am creating an alarm

Setting a new alarm in Apple's Clock App from another application

喜夏-厌秋 提交于 2019-12-05 19:37:08
问题 I have searched for references to this and have found a few teasers, but nothing comprehensive. I'm looking for a way to set up (and, perhaps delete, although not absolutely necessary) a new alarm in the actual IOS Alarm Clock application from a new (self-created) app. Basically, the app I'm creating would programmatically add a new alarm (setting the time, and including choosing a ring tone) to the Clock app, which would then simply behave as it normally does -- making the built-in alarm

Start activity when screen is off

蓝咒 提交于 2019-12-05 15:07:09
I have set up an AlarmManager to start up an activity. This activity also plays a sound, similar to an alarm app or an incoming call. It works ok if the screen is on, even if the screen is locked. If the screen is off, it doesn't work at all. I tried using the following as the first thing in onCreate getWindow().setFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON, WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); If the screenlock is not enabled, this turns on the screen and I can see my activity closing. I can't hear the sound playing. If the screenlock is enabled, the screen won't turn on

What else can i do 'sleep' when the sleep() can't work well with alarm?

ぐ巨炮叔叔 提交于 2019-12-05 06:31:29
There are many documents say "you should avoid using sleep with alarm, since many systems use alarm for the sleep implementation". And actually, I'm suffering with this problem. So does anyone can help me that what else i can do 'sleep' when the sleep() can't work well with alarm? I have already tried 'usleep' of the Time::HiRes module, and select() function. But they didn't work either. You can try AnyEvent : use AnyEvent; my $cv = AnyEvent->condvar; my $wait_one_and_a_half_seconds = AnyEvent->timer( after => 1.5, cb => sub { $cv->send } ); # now wait till our time has come $cv->recv; DrHyde

Chrome Extension Alarms go off when Chrome is reopened after time runs out?

半世苍凉 提交于 2019-12-05 02:04:32
问题 When using Google Chrome extension alarms, the alarm will go off if it was set and Chrome is closed and reopened after the time expires for the alarm. How can I stop this? Here is a small code sample to explain what I mean. /* If we perform Browser Action to create alarm, then close the browser, wait about 2 minutes for the alarm to expire and then reopen the browser, the alarm will go off and the DoSomething function will get called twice, once by the onStartup event and once by the onAlarm

How to detect if a notification has been dismissed?

天大地大妈咪最大 提交于 2019-12-04 22:21:46
Is there any way in Android to detect when a user swipes a notification to the left and deletes it? I'm using an alarmmanager to set a repeating alert and I need my repeating alert to stop when the notification is cancelled by the user. Here's my code: Setting the repeating alert: AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), repeatFrequency, displayIntent); My notification code: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Get the

iOS - How can I schedule something once a day?

独自空忆成欢 提交于 2019-12-04 19:26:37
I know there is NSTimer.scheduledTimerWithInterval Which is used like this: override func viewDidLoad() { super.viewDidLoad() var timer = NSTimer.scheduledTimerWithTimeInterval(0.4, target: self, selector: Selector("update"), userInfo: nil, repeats: true) } func update() { // Something cool } But I assume that the view where var timer is living must be living too, ie: can't close that view (am I right?) How can I schedule something once a day in iOS, eg: everyday at 8pm send a notification? In Android I've achieved this the following way: I've used a thing called AlarmManager , that is similar

Android: Pending intent not calledon snooze with multiple alarm

ぐ巨炮叔叔 提交于 2019-12-04 18:33:31
I am working on adding multiple alarm functionality in my existing app. Earlier, the alarm was single only and every thing worked fine. I have been able to set multiple alarms, it is working fine too, but problem is with snooze feature. Earlier, snooze was working perfect. But, after multiple alarm implementation it is not working. I never get dialog for snoozing alarm, once I press snooze button. Here is my code: Set alarm method public void setAlarm(boolean AlarmEnabled, int AlarmHour, int AlarmMin) { //Build Intent/Pending Intent for setting the alarm Intent AlarmIntent = new Intent

Multiple cell phone alarms, which one covers the other. Which alarm is preceded? How it works?

故事扮演 提交于 2019-12-04 18:16:42
Lets say i set up two alarms 09:00:00 (alarm1) 09:10:00 (alarm2) and every alarm can snooze for 10 minutes. Then alarm1 sounds and i snooze it at 09:00:10 so it must ring again at 09:10:10 BUT at time 09:10:00 already the alarm2 is ringing an i snooze it at 09:10:11. what will happen to the alarm1? when will the first alarm be replayed? To me the following happened. When it was time for the alarm2 to be activated, the alarm1 actually activated. 1st experiment: I postponed alarm1 and the alarm2 deactivated. 2nd experiment: I turned the alarm1 off and the alarm2 was activate, but it was