草庐IT

Pendingintent

全部标签

Android:获取所有使用 AlarmManager 设置的 PendingIntents

我正在设置这样的闹钟:alarmManager.set(AlarmManager.RTC_WAKEUP,alarmTime,pendingEvent);我有兴趣删除之前设置的所有警报,并清除它们。有没有办法让我这样做或获取当前设置的所有警报,以便我可以手动删除它们? 最佳答案 您不必一直引用它。只需定义一个新的PendingIntent就像您在创建它时定义的一样。例如:如果我创建了一个待由AlarmManager触发的PendingIntent,如下所示:IntentalarmIntent=newIntent(getApplicat

android - 在 AlarmManager 中获取 Activity 的 PendingIntents 列表

我有办法获取设备中ActivityPendingIntent的列表吗?我开始使用AlarmManager,我想看看我的PendingIntent是否被正确创建和删除。如果有什么其他的PendingIntent也很高兴,只是想看看某个应用是否在做一些“额外的工作”。 最佳答案 adbshelldumpsysalarm>dump.txt转储.txt:CurrentAlarmManagerstate:Realtimewakeup(now=1309361618777):RTC_WAKEUP#5:Alarm{4822f618type0com.

android - 在 AlarmManager 中获取 Activity 的 PendingIntents 列表

我有办法获取设备中ActivityPendingIntent的列表吗?我开始使用AlarmManager,我想看看我的PendingIntent是否被正确创建和删除。如果有什么其他的PendingIntent也很高兴,只是想看看某个应用是否在做一些“额外的工作”。 最佳答案 adbshelldumpsysalarm>dump.txt转储.txt:CurrentAlarmManagerstate:Realtimewakeup(now=1309361618777):RTC_WAKEUP#5:Alarm{4822f618type0com.

android - 通知通过旧的 Intent Extras

我正在通过此代码在BroadcastReceiver中创建通知:Stringns=Context.NOTIFICATION_SERVICE;NotificationManagermNotificationManager=(NotificationManager)context.getSystemService(ns);inticon=R.drawable.ic_stat_notification;CharSequencetickerText="NewNotification";longwhen=System.currentTimeMillis();Notificationnotific

android - 通知通过旧的 Intent Extras

我正在通过此代码在BroadcastReceiver中创建通知:Stringns=Context.NOTIFICATION_SERVICE;NotificationManagermNotificationManager=(NotificationManager)context.getSystemService(ns);inticon=R.drawable.ic_stat_notification;CharSequencetickerText="NewNotification";longwhen=System.currentTimeMillis();Notificationnotific

android - 如何检查 AlarmManager 是否已经设置了警报?

当我的应用程序启动时,我希望它检查特定警报(通过AlarmManager注册)是否已设置并正在运行。谷歌的结果似乎表明没有办法做到这一点。这仍然正确吗?我需要进行此项检查,以便在采取任何行动创建新警报之前通知用户。 最佳答案 跟进ron发表的评论,这里是详细的解决方案。假设您已经注册了一个带有待处理Intent的重复警报,如下所示:Intentintent=newIntent("com.my.package.MY_UNIQUE_ACTION");PendingIntentpendingIntent=PendingIntent.get

android - 如何检查 AlarmManager 是否已经设置了警报?

当我的应用程序启动时,我希望它检查特定警报(通过AlarmManager注册)是否已设置并正在运行。谷歌的结果似乎表明没有办法做到这一点。这仍然正确吗?我需要进行此项检查,以便在采取任何行动创建新警报之前通知用户。 最佳答案 跟进ron发表的评论,这里是详细的解决方案。假设您已经注册了一个带有待处理Intent的重复警报,如下所示:Intentintent=newIntent("com.my.package.MY_UNIQUE_ACTION");PendingIntentpendingIntent=PendingIntent.get

android - 什么是 Android PendingIntent?

我是Android新手。我阅读了Android文档,但我仍然需要更多说明。谁能告诉我PendingIntent到底是什么? 最佳答案 PendingIntent是您提供给外部应用程序的token(例如NotificationManager、AlarmManager、主屏幕AppWidgetManager或其他3rd方应用程序),它允许外部应用程序使用您的应用程序的权限来执行预定义的一段代码。如果你给外部应用一个Intent,它会以自己的权限执行你的Intent。但是如果你给外部应用一个PendingIntent,那个应用会使用你应用

android - 什么是 Android PendingIntent?

我是Android新手。我阅读了Android文档,但我仍然需要更多说明。谁能告诉我PendingIntent到底是什么? 最佳答案 PendingIntent是您提供给外部应用程序的token(例如NotificationManager、AlarmManager、主屏幕AppWidgetManager或其他3rd方应用程序),它允许外部应用程序使用您的应用程序的权限来执行预定义的一段代码。如果你给外部应用一个Intent,它会以自己的权限执行你的Intent。但是如果你给外部应用一个PendingIntent,那个应用会使用你应用

android - 多次调用 AlarmManager.setRepeating 提供相同的 Intent/PendingIntent 额外值,但我提供了不同的值

在写这个问题时解决了,但发布以防万一:我正在设置多个这样的警报,具有不同的id值:AlarmManageralarms=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);Intenti=newIntent(MyReceiver.ACTION_ALARM);//"com.example.ALARM"i.putExtra(MyReceiver.EXTRA_ID,id);//"com.example.ID",2PendingIntentp=PendingIntent.getBroadcast(context,0,i,0