alarmmanager

AlarmManager not fires on time in Android Lollipop

落爺英雄遲暮 提交于 2019-12-10 14:25:26
问题 i'm using this code to set Alarm in Android KitKat and lollipop: AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE); Intent i = new Intent(AlarmService.this, Reciver.class); PendingIntent pi = PendingIntent.getBroadcast(AlarmService.this, 1201, i, PendingIntent.FLAG_UPDATE_CURRENT); Calendar c = Calendar.getInstance(); c.set(Calendar.HOUR_OF_DAY, 9); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); am.setExact(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), pi); this code is

Sending new intent to broadcast receiver gives extras values from previous intent

懵懂的女人 提交于 2019-12-10 13:28:55
问题 I am broadcasting a intent which will be received by a broadcast receiver, as application is still running and new intent is fired by Alarm Service but the receiver is showing the previous intent value. As per docs broadcast receiver is no longer active after returning onReceive(), so receiver should show next intent values which is fired by alarm service, but it is not happening, can any one tell correct approach. This is from activity to broadcast intent: Intent intent = new Intent(SCH

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

Android: Save android.net.Uri object to Database

二次信任 提交于 2019-12-10 12:45:53
问题 What i m trying to do is get the selected ringtone from the user, set an AlarmManager alarm to play that ringtone when the alarm goes Off. but I need to save the ringtone in the database so I can reset all the alarms after phone reboot. my question is what is the best way to save the ringtone Uri to the database to retrieve later? I tried the followings: 1) save the ringtone title in the DB and then retrieve it and append it to a default ringtone path. but the issue, is that the ringtone

What happens when I start an alarm twice?

梦想的初衷 提交于 2019-12-10 12:34:23
问题 I'm Jumping trough hoops (well, it's not that complicated ofcourse) to avoid starting an alarm twice. The basic code goes like this: AlarmManager mgr=(AlarmManager)getSystemService(Context.ALARM_SERVICE); Intent i=new Intent(this, MyService.class); PendingIntent pi=PendingIntent.getService(this, 0, i, 0); mgr.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime(), AlarmManager.INTERVAL_FIFTEEN_MINUTES, pi); Would it matter if I would actually run this code

Repeating notification

浪尽此生 提交于 2019-12-10 12:08:25
问题 I'm trying to set a notification that is repeated each day at a fixed hour. I'm able to set a notification by clicking on an item in a list (but that's not really interesting...) I've tried several things but I still can't make it appear automatically nor daily... Here is what I've done so far: public class main extends Activity implements PersonneAdapterListener { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate

Android, permission denial using BOOT_COMPLETED intent

牧云@^-^@ 提交于 2019-12-10 11:41:09
问题 I have a BootReceiver and is using android.intent.action.BOOT_COMPLETED to reconfigure whatever alarms the user made in my app, before phone was powerd off. Im using AlarmManager to set the alarms again. The alarms are stored in a SQLite database. public class BootReceiver extends BroadcastReceiver { private Context mContext; @Override public void onReceive(Context c, Intent intent) { mContext = c; try { cursor.moveToFirst(); do { Intent i = new Intent(mContext, AlarmReceiver.class); i

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: Is there a way to stop AlarmReceiver fired in BootReceiver

╄→尐↘猪︶ㄣ 提交于 2019-12-10 10:58:10
问题 I am using a Boot receiver to fire AlarmManager,so that it repeats it's task every minute. I'd like the user to have in app option to enable/disable action that is done in every repeat of AlarmManager. So far I only used only a lame solution. I set user's preference in SharedPreferences and in every repeat of AlarmManager I check for user's preference in SharedPreferences and based on this preference the functionality is either executed or ignored. So far to my best knowledge, there is no way

After rebooting my device,sending sms frequently is sending sms one more time also while switch on

*爱你&永不变心* 提交于 2019-12-10 10:14:47
问题 I am sending sms frequently,while rebooting my device sending sms one more time while we "switch on" also.After that its sending sms correct intervals.But its sending the sms one more time when we switch on our device. public class BootCompletedIntentReceiver extends BroadcastReceiver { @Override public void onReceive(Context ctxt, Intent i) { try { scheduleAlarms(ctxt); } catch (java.text.ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @SuppressLint(