android-alarms

How to Set up Alarm Same like Alarm App in Android?

房东的猫 提交于 2019-12-11 00:03:34
问题 I am trying to setup alarm outside of my app with little popup box. I made that popup box by using Activity.I been trying for a long time to setup alarm like Alarm app but i get failed in some situations. I am successful if i am exiting the app from the launch activity by using back button. But when i press home button the alarm keep working charm but with last used activity in background. I am not sure why this happening and i would like to know how i can make this work with out any activity

Oreo: Alarm is not fired when Application is not running

纵饮孤独 提交于 2019-12-10 20:43:17
问题 I have relatively simple setup that should trigger an alarm at certain time of the day and show a notification to user. here is relative code, Setting the alarm long inTime = /*expirationTime*/ Calendar.getInstance().getTimeInMillis() + 10000; Intent startIntent = new Intent("parking.event"); startIntent.setClass(getBaseContext(), ParkingExpirationWarmingBroadcast.class); PendingIntent startPendingIntent = PendingIntent.getBroadcast(this, 99, startIntent, 0); alarmMgr.setExact(AlarmManager

Difference between setAndAllowWhileIdle and setExactAndAllowWhileIdle

江枫思渺然 提交于 2019-12-10 20:32:37
问题 What is difference between AlarmManager.setAndAllowWhileIdle() and AlarmManager.setExactAndAllowWhileIdle() ? How does these both affect Doze mode introduced in Android 6.0 (Marshmallow) API? 回答1: Refer to the documentation of AlarmManager : Note: Beginning with API 19 (KITKAT) alarm delivery is inexact: the OS will shift alarms in order to minimize wakeups and battery use. There are new APIs to support applications which need strict delivery guarantees; see setWindow(int, long, long,

AlarmManager firing alarm past the time it was set on the same day, setRepeating

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 13:04:09
问题 So basically I have this code, time returns 24hour time and repeats the alarm daily. public setAlarm(String time, Context context){ String[] strTime; strTime = time.split(":"); int hour, min, sec; //set when to alarm hour = Integer.valueOf(strTime[0]); min = Integer.valueOf(strTime[1]); sec = 0; Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, hour); cal.set(Calendar.MINUTE, min); cal.set(Calendar.SECOND, sec); //Create a new PendingIntent and add it to the AlarmManager

Setting multiple Intents for AlarmManager

℡╲_俬逩灬. 提交于 2019-12-10 12:02:03
问题 I use AlarmManager to schedule multiple taks, i.e. Task 1 at 10:56, Task 2 at 11:24 and so on. Here's the code: intent = new Intent(ACTION_RECORDER_START); intent.putExtra(EXTRA_COMMAND_ID, command.id); pendingIntent = PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_ONE_SHOT); alarmManager.set(AlarmManager.RTC_WAKEUP, command.start, pendingIntent); Here's the strange thing: If I set one alarm, it does job well. If I set two, only the last alarm is fired. So, I guess the

unable cancel PendingIntents - Android

大兔子大兔子 提交于 2019-12-10 11:33:50
问题 I have programmed an alarm system that synchronizes with the server where are the information. Sometimes, in the updates on the server some alarms are deleted. Now, it is well removed from the database db4o but I can't cancel pendingIntents already programmed. Now, I've the following code: PendingIntent pendingIntent; public class xxx{ public void updateObjects(){ alarmManager.cancel(pendingIntent);//delete all alarms (...) for(...){ //Update each object ofdb4o with the new object value's. (.

Android: Pending intent not calledon snooze with multiple alarm

旧城冷巷雨未停 提交于 2019-12-09 23:50:46
问题 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

Cancelling a single alarm when you have multiple alarms

荒凉一梦 提交于 2019-12-09 16:04:31
问题 I have used the same pendingIntent to set multiple alarms using different intentId for each. the alarm is working. Now i want to cancel a particular alarm. If i use the cancel() method i would end up cancelling all the alarms. I want only a specific one to be deleted. Also the user should be able to cancel this alarm even during a second or a third launch. As in when i launch it the second time, i won't be having the same pendingIntent object. Would i have to persist the pendingIntent object?

How to set timer to call a function every n minutes?

半城伤御伤魂 提交于 2019-12-09 09:20:20
问题 I want to set up a timer in an Android application that will call a function after every 15/30/45 and n minutes when user login. But also it will stop timer when user log off. and timer begin from start if user login again. I want that option(15/30/45/n miutes) to be saved in database so that I can update list after sync. Is Timer a good approach or I need to use alarm services? Or is there any system services required? Is it possible to change previous doc/file in local phone database

Android: Alarm to be play every 30 minutes and it start from 12:30

╄→гoц情女王★ 提交于 2019-12-09 01:44:05
问题 Here i am going to use the alarm service to play the alarm at every 30 minutes. Right now i have set it to play it at every 10 second from the Every start. Here is the Code: @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.settings_layout); Intent myIntent = new Intent(SettingsActivity.this, MyAlarmService.class); pendingIntent = PendingIntent.getService(SettingsActivity.this, 0, myIntent, 0); AlarmManager alarmManager =