Tag: android pendingintent

如何通过PendingIntent将自定义Serializable对象传递给BroadcastReceiver

我试图使用PendingIntent将自定义的Serialized对象从我的IntentService传递给BroadcastReceiver。 这是我的自定义对象: Row.java public class Row implements Serializable { private String name; private String address; public Row(BluetoothDevice device) { this.name = device.getName(); this.address = device.getAddress(); } } 这是我的IntentService MyIntentService.java public class MyIntentService extends IntentService { public MyIntentService() { super(“MyIntentService”); } @Override public void onCreate() { super.onCreate(); } @Override protected void onHandleIntent(Intent workIntent) { AlarmManager alarmMgr; […]

AlarmManager setInexactRepeating,setWindow,setRepeating方法在工作日内从循环内调用时不会触发警报

要求: – 我需要在一周的特定日期和警报开始的日期发出警报(例如我想在2017年5月26日下午6:45开始的每周的周五和周六发出警报) 问题:- 当从循环内调用AlarmManager setInexactRepeating , setWindow或setRepeating方法时,BroadcastReceiver的onReceive()方法不会执行。 用于此任务的代码如下: – AndroidManifest.xml中 <!– –> ActivitySaveReminder.java public class ActivitySaveReminder extends AppCompatActivity{ onCreate() { fireAlarmOnWeekDays(); } public void fireAlarmOnWeekDays() { long[] weekDaysMillisecondsArr = {1495737000000l, 1495823400000l}; long[] alarmStartMillisArr = {1495801680000l}; Calendar calendar = Calendar.getInstance(); for (int i = 0; i > selected day time stamp –> “+calendar.getTime()); for (int […]