Android8.0新的更改,导致api26以上PendingIntent不能正常发送广播,解决办法如下:
Intent intent = new Intent(Alarms.UPDATE_NOTIFY_ACTION);
intent.setClass(this, AlarmReceiver.class);//为其指明广播接收器,已成为发送显式广播
PendingIntent sender = PendingIntent.getBroadcast(this, 0, intent,
PendingIntent.FLAG_CANCEL_CURRENT);