alarmmanager

Reminder Functionality

核能气质少年 提交于 2019-12-01 01:10:59
In my application i am trying to set reminder and alarm on that reminder but i am not able to do so. As i don't have complete and proper knowledge of how to set reminder, edit it and delete it. As i searched on google and what i got is not easy to understand for me. I tried a code as: Main.java Calendar cal = Calendar.getInstance(); java.util.Calendar; // add minutes to the calendar object cal.set(Calendar.MONTH, 4); cal.set(Calendar.YEAR, 2011); cal.set(Calendar.DAY_OF_MONTH, 5); cal.set(Calendar.HOUR_OF_DAY, 21); cal.set(Calendar.MINUTE, 43); Intent alarmintent = new Intent

AlarmManager or Service

▼魔方 西西 提交于 2019-12-01 00:19:02
I'm a C++ developer and developing my first Android application. My application is an special kind of Reminder. I'm looking for the best way to do it. I have tried this approaches: Use a Service Use an AlarmManager My question is that can I use AlarmManager singly? Is it a CPU time consuming task considering that my AlarmManager should be fired every 1 second ? (It seems that every time an AlarmManager is executed a new process except main process is created and immediately is killed). If I use a service then my application should always stay in memory and also what happens if is killed by

AlarmManager delete all schedules on power-off?

孤街醉人 提交于 2019-12-01 00:16:37
I have set an alarm at specific time. If the phone is turn off the alarm is lost? I have turn off the phone, start it again but the alarm did not trigger at the specified time. PendingIntent pendingIntent = PendingIntent.getBroadcast( Global.a.getApplicationContext(), (int) cd.e.alarmTime, intent, 0); AlarmManager alarmManager = (AlarmManager) Global.a.getSystemService(Activity.ALARM_SERVICE); alarmManager.set(AlarmManager.RTC, cd.e.alarmTime, pendingIntent); First you need to create a BroadcastReceiver to trigger on BOOT_COMPLETE public class BootReceiver extends BroadcastReceiver { @Override

Alarm not getting stopped

梦想的初衷 提交于 2019-11-30 21:40:16
问题 I am trying to stop the alarm and checking it whether it stopped or not, but it always returns true means alarm is working. I tried to stop the alarm based on the answer in the link https://stackoverflow.com/a/17616299/1226882 but it doesnt work for me. Please refer the below code Start Alarm public static void startSchedulerAlaram(Context ctx) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar

Reminder Functionality

和自甴很熟 提交于 2019-11-30 21:38:52
问题 In my application i am trying to set reminder and alarm on that reminder but i am not able to do so. As i don't have complete and proper knowledge of how to set reminder, edit it and delete it. As i searched on google and what i got is not easy to understand for me. I tried a code as: Main.java Calendar cal = Calendar.getInstance(); java.util.Calendar; // add minutes to the calendar object cal.set(Calendar.MONTH, 4); cal.set(Calendar.YEAR, 2011); cal.set(Calendar.DAY_OF_MONTH, 5); cal.set

How to edit/reset Alarm Manager?

故事扮演 提交于 2019-11-30 21:14:50
I've set up a Preference Screen in which i have a list preference which allows user to select time interval to notify them. They can choose whether to notify them after every 2,4,8,10 or 12 hours. Here's my list preference: <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > <ListPreference android:title="Notification Timer" android:summary="Select when to Notify" android:dialogTitle="Show Notification after every:" android:positiveButtonText="OK" android:negativeButtonText="Cancel" android:entries="@array/entries" android

BroadcastReceiver (TIME_TICK) dies every night?

女生的网名这么多〃 提交于 2019-11-30 20:50:12
问题 I want to write some kind of background-live-ticker app for sports-web-services... I would like my app to be able to call the TIME_TICK all the time. Btw: I also tried to use the AlarmManager, but the problem is the same. But now my problem... I use a Receiver with a Service for the execution part. The Receiver is called every minute correctly after register. But every night the service is terminated and will never be called again. On Android 2.x everything works fine but Android 4.x will

AlarmManager not working properly

戏子无情 提交于 2019-11-30 20:13:30
I'm trying to create an alarm based application. I'm using AlarmManager . The thing is that it's not reliable at all. In some devices it works.. in other devices it works somethimes.. and in other devices it doesn't work at all. When I say that it doesn't work is that simply, alarms won't fire. For example, in my Xiaomi Mi4, if you turn off the screen, no alarm will fire. I have a testing Moto G and in that phone alarms use to work fine, but in OnePlus, alarms won't fire too. They simply are never called. Am I missing something? Does anybody know what am I doing wrong?? Thanks a lot for your

What is the definition of asleep for an android device?

为君一笑 提交于 2019-11-30 18:34:53
I'm using alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME, 0, DURATION, broadcast); To schedule an repeating task that should only be executed if the device is not asleep. As I understand the API on the AlarmManager the intent will be called once the device wakes up from sleep. Now when is an Android device asleep? For testing I set the duration to two minutes and connected the device to my machine. Now I'm watching logcat and every two minutes it will spit out my debug message. I always thought that an deactivated screen means that the devices starts sleeping. Or is my looking

AlarmManager or Service

旧街凉风 提交于 2019-11-30 18:34:12
问题 I'm a C++ developer and developing my first Android application. My application is an special kind of Reminder. I'm looking for the best way to do it. I have tried this approaches: Use a Service Use an AlarmManager My question is that can I use AlarmManager singly? Is it a CPU time consuming task considering that my AlarmManager should be fired every 1 second ? (It seems that every time an AlarmManager is executed a new process except main process is created and immediately is killed). If I