alarm

Delete alarm from AlarmManager using cancel() - Android

↘锁芯ラ 提交于 2019-11-26 15:19:57
I'm trying to create and delete an alarm in two different methods which are both called at different moments in the application logic. However when I call AlarmManager's cancel() method, the alarm isn't deleted. Here's my addAlarm() Method : AlarmManager alarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(PROX_ALERT_INTENT); intent.putExtra("ALERT_TIME", alert.date); intent.putExtra("ID_ALERT", alert.idAlert); intent.putExtra("TITLE", alert.title); intent.putExtra("GEO_LOC", alert.isGeoLoc); PendingIntent pendingIntent = PendingIntent

getExtra from Intent launched from a pendingIntent

你离开我真会死。 提交于 2019-11-26 15:19:33
问题 I am trying to make some alarms after the user selects something with a time from a list and create a notification for it at the given time. My problem is that the "showname" that a putExtra on my Intent cant be received at the broadcast receiver. It always get null value. This is the way I do it for most of my intents but I think this time maybe because of the pendingIntent or the broadcastReceiver something need to be done differentelly. Thank you The function that sends the Intent through

Android - how to set an alarm to a specific date

喜夏-厌秋 提交于 2019-11-26 10:53:00
问题 I have seen a lot of tutorials and been trying for 2 hours now , though something is still wrong. I am very nervous now :) I want to set an alarm e.g. to 16:25 to go off, but nothing happens. I have this code: Calendar cur_cal = new GregorianCalendar(); cur_cal.setTimeInMillis(System.currentTimeMillis()); Calendar cal = new GregorianCalendar(); cal.add(Calendar.DAY_OF_YEAR, cur_cal.get(Calendar.DAY_OF_YEAR)); cal.set(Calendar.HOUR_OF_DAY, 16); cal.set(Calendar.MINUTE, 25); cal.set(Calendar

python: windows equivalent of SIGALRM

不打扰是莪最后的温柔 提交于 2019-11-26 08:32:02
问题 I have this decorator: def timed_out(timeout): def decorate(f): if not hasattr(signal, \"SIGALRM\"): return f def handler(signum, frame): raise TimedOutExc() @functools.wraps(f) def new_f(*args, **kwargs): old = signal.signal(signal.SIGALRM, handler) signal.alarm(timeout) try: result = f(*args, **kwargs) finally: signal.signal(signal.SIGALRM, old) signal.alarm(0) return result new_f.func_name = f.func_name return new_f return decorate The code only does anything on linux, though, as on

Start app at a specific time

浪子不回头ぞ 提交于 2019-11-26 08:08:51
问题 I was wondering if it\'s possible (and if it is how) to start up my app at a specific time, something like an alarmclock which goes off at a specific time. Let\'s say I want my app to start up at 8 in the morning, is that feasable ? 回答1: You can do it with AlarmManager, heres a short example. First you need to set the alarm: AlarmManager am = (AlarmManager) con.getSystemService(Context.ALARM_SERVICE); Date futureDate = new Date(new Date().getTime() + 86400000); futureDate.setHours(8);

How to automatically restart a service even if user force close it?

荒凉一梦 提交于 2019-11-26 07:00:04
问题 I want a service to run all the time in my application. So I want to restart it even if it is force closed by user. There is definitely a way to do it as apps like facebook are doing it.(Its not done using push notification, facebook restarts its service even if internet is off). Any help would be appreciated. Thanks! 回答1: First of all, it is really very bad pattern to run service forcefully against the user's willingness . Anyways, you can restart it by using a BroadcastReceiver which

Android Alarm Clock UI

大兔子大兔子 提交于 2019-11-26 04:54:38
问题 I am trying to figure out how the UI was designed for the Android Alarm Clock app. This appears to be using the Holo Dark Theme. The screenshot included is the Create/Edit Alarm Activity screen. It looks similar to Android Settings. Is this case? Because the \"Turn the alarm on\" & \"Vibrate\" rows look like ChexboxPreferences . The \"Ringtone\" row looks like a RingtonePreference . What about the \"Time\" row? As @eric mentioned in the comments to one of the answers below, I am trying to

Delete alarm from AlarmManager using cancel() - Android

本小妞迷上赌 提交于 2019-11-26 04:20:06
问题 I\'m trying to create and delete an alarm in two different methods which are both called at different moments in the application logic. However when I call AlarmManager\'s cancel() method, the alarm isn\'t deleted. Here\'s my addAlarm() Method : AlarmManager alarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(PROX_ALERT_INTENT); intent.putExtra(\"ALERT_TIME\", alert.date); intent.putExtra(\"ID_ALERT\", alert.idAlert); intent.putExtra(\

How to cancel this repeating alarm?

耗尽温柔 提交于 2019-11-26 03:35:59
问题 I\'m writing something like a reminder for users. Users will set reminders for their events, when the time comes, a repeating alarm will be set to trigger a status bar notification. But the alarm seems non-stop after I selected the notification or cleared the notification. I am not sure where to cancel this repeating alarm. Below are some of the codes: Set up the repeating alarm in my main activity alarmTime = Calendar.getInstance(); Intent intent = new Intent(this, AlarmReceive.class);

Using Alarmmanager to start a service at specific time

谁说胖子不能爱 提交于 2019-11-26 03:21:19
问题 I have searched a lot of places but couldnt find a clean sequential explanation of how to start a service (or if thats not possible then an activity) at a specific time daily using the AlarmManager?? I want to register several such alarms and triggering them should result in a service to be started. I\'ll be having a small piece of code in the service which can then execute and i can finish the service for good.... Calendar cal = Calendar.getInstance(); Calendar cur_cal = Calendar.getInstance