草庐IT

pendingintent

全部标签

Android - 清除任务标志不适用于 PendingIntent

我有一个A>B>C的任务堆栈。我目前在C上,然后我按下主页按钮。我收到一条通知,目的是带我去ActivityA。我按下通知,我在A,但如果我按回去,我会转到C,然后是B,然后是A。我正在这样设置我的PendingIntent。有什么明显的问题吗?finalIntentnotificationIntent=newIntent(mContext,ActivityA.class);notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_NEW_TASK);PendingIntentcon

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

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

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,那个应用会使用你应用