Android-从周期性重复的挂起通知中获取剩余时间
我根据用户在应用程序中插入的某些值设置了一个挂起通知,如下所示:Android-从周期性重复的挂起通知中获取剩余时间,android,push-notification,kotlin,android-pendingintent,Android,Push Notification,Kotlin,Android Pendingintent,我根据用户在应用程序中插入的某些值设置了一个挂起通知,如下所示: val notificationAlarmManager = getSystemService(Context.ALARM_SERVICE) as AlarmManager val notificationIntent = Intent(this, ReminderBroadcastReceiver::class.java) notificationIntent.putExtra("
val notificationAlarmManager = getSystemService(Context.ALARM_SERVICE) as AlarmManager
val notificationIntent = Intent(this, ReminderBroadcastReceiver::class.java)
notificationIntent.putExtra("bytes", bytes)
val pendingNotificationIntent = PendingIntent.getBroadcast(this, REQUEST_CODE, notificationIntent,
PendingIntent.FLAG_UPDATE_CURRENT)
myCalendar.set(Calendar.HOUR_OF_DAY, 10)
notificationAlarmManager.setRepeating(AlarmManager.RTC_WAKEUP, myCalendar.timeInMillis,
NOTIFICATION_OFFSET,
pendingNotificationIntent)
由于这是一个重复的意图,我只能计算第一个通知,之后的通知无法计算
如何获取通知再次显示之前的剩余时间?如果您为日历实例设置了确切的日期和时间,那么使用通知时间-当前设备时间来计算挂起时间会更容易
希望这有帮助。没错,但我如何获得通知时间?