alarm

alarm triggers even after finish time in android

感情迁移 提交于 2019-12-12 02:36:24
问题 I am creating small Alarm project which has week days option. (I am using alarm manager). The alarm triggers perfectly on given time and day but the problem is that it also triggers any previous alarm if I change the day or time after to the given alarm time. For eg. If the alarm is set to ring at 5:00 AM Monday Wednesday Friday. - And the current time is 6:00PM Sunday. And another alarm set for for 4:00PM Monday Wednesday Friday - The current time is 6:30PM Sunday. For testing I changed the

j2me running thread while device is in energy saving mode

送分小仙女□ 提交于 2019-12-12 01:55:31
问题 I have created an application which stores a set five different times, at each time i play an audio. I have done this using thread. But the audio does not play when the device is not in active mode. How can i play the audio despite the status of the mobile? In android i have done this using alarm manager. Is there such an option in j2me? Please help with code if you have the solution. 回答1: If i remember correctly, background operations are not possible in j2me, due to midlet lifecycle. If

Alarm manager: repeating alarm not always fires

别等时光非礼了梦想. 提交于 2019-12-12 01:46:42
问题 I'm trying to develop a kind of reminders system, so user can enter days for reminders (MON, TUE...) and times on which this reminder will fire (only hour and minutes). It can be any day of the week or multiple days of the week. Here is the code for setting these reminders: final AlarmManager alarmMgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); for (final Day day: reminder.getDays()) { for (final ReminderTime reminderTime: reminder.getTimes()) { final Calendar calendar =

Should an alarm be built with Service or BroadcastReceiver?

寵の児 提交于 2019-12-11 20:42:11
问题 I want to build an alarm application. I've seen some examples and some of them use Service and some use BroadcasterReceiver. The user will set the alarm and then when it goes off they'll have to do certain things like solve a mathematical equation or scan NFC tag before it turns off. Which one should I use? 回答1: If you are using AlarmManager with a _WAKEUP alarm, you must have the PendingIntent route to a BroadcastReceiver . The only thing Android guarantees with a _WAKEUP alarm is if you use

How to set an AlarmManager for preselected days?

谁说胖子不能爱 提交于 2019-12-11 19:46:27
问题 I'm creating an alarm widget, and it works, however, I'm currently using it for a single day, I'd like to know how to define it for predefined days, let's say for example I want to setup the alarman for monday, wednesday and friday, how can I accomplish that? Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, dPicker.getYear()); cal.set(Calendar.MONTH, dPicker.getMonth()); cal.set(Calendar.HOUR_OF_DAY, tPicker.getCurrentHour()); cal.set(Calendar.MINUTE, tPicker.getCurrentMinute());

Perl getting segmentation fault while timeout using alarm

折月煮酒 提交于 2019-12-11 18:49:03
问题 I'm writing Perl for the first time and Internet tells me i can use alarm if i have a long running sql query. I need to run a SP which will run for hours in a Perl, and i would like to set a time limit. Below is the last step of my codes but i'm getting segmentation fault when the process runs longer that my timeout, in this occasion sleep(20). Logs shows it finished printing ---1---- and then segmentation fault. How can I fix this? I tried taking sub DelRef{} out into a seperate .pl and

Cannot figure out how to create the cancel button for ringing alarm

我只是一个虾纸丫 提交于 2019-12-11 17:57:58
问题 I am having trouble to stop the alarm from ringing even after I have pressed the stopAlarm button. I cannot figure out how to get access to the same Ringtone instance and call stop(). This is my start alarm switch in MainActivity java class. public void switchClicked(View view) { if (((Switch) view).isChecked()) { Log.d("MainActivity", "Alarm On"); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, alarmTimePicker.getHour()); calendar.set(Calendar.MINUTE,

repeating local Notifications automatically?

自闭症网瘾萝莉.ら 提交于 2019-12-11 17:44:03
问题 So I've managed to create a local notification in android. Part of the code is given below. AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE); alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,calendar.getTimeInMillis(),alarmManager.INTERVAL_DAY,pendingIntent); Now no problem with creating the notification. The thing is that I am currently testing it with a button press which starts the whole notification thing with the Notification appearing every day at the the same

Android alarm sets off immediately

女生的网名这么多〃 提交于 2019-12-11 16:32:20
问题 Why does the alarm set off immediately instead of the specified time? Intent myIntent = new Intent(Notepad.this, MyAlarmService.class); PendingIntent pendingIntent = PendingIntent.getService(Notepad.this, 0, myIntent, 0); AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.set(Calendar.YEAR, 2012); calendar.set(Calendar.MONTH, 4); calendar.set(Calendar.DAY_OF_MONTH

Python LIRC blocking Signal workaround not working

纵然是瞬间 提交于 2019-12-11 16:16:05
问题 I've been having trouble with the Python LIRC function lirc.nextcode() . I turned off blocking, which allows the code lirc.nextcode() to be skipped if the LIRC queue is empty, by initializing with lirc.init("program", blocking=False) and tried lirc.set_blocking(False, sockid) . Neither worked and the code would always hang, waiting for a button press, when it should continue on. I found this workaround that puts a time limit on raw_input('prompt') . So even if my lirc.nextcodde() waits for a