草庐IT

pendingintents

全部标签

android - 通过 PendingIntent 问题发送 EXTRA 数据

您好,我正在尝试通过PendingIntent发送额外数据。这是我的代码//**1**Intentintent=newIntent(context,UpdateService.class);intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,appWidgetId);intent.putExtra(BaseConfigurationActivity.EXTRA_WIDGET_MODE,2);//putappWidgetIdhereorintentwillreplaceanintentofanotherwidgetPendingInte

android - 如何从 PendingIntent 获取 Intent

我可以从PendingIntent中获取Intent吗?场景如下:我创建了一个Intent(我们称它为myIntent)我把一些额外的信息放在一个字符串中(称之为myInfo)我使用myIntent创建一个PendingIntent(myPendingIntent)我使用AlarmManager和myPendingIntent设置闹钟在稍后阶段,我使用PendingIntent.getBroadcast获取PendingIntent那时我想从myIntent中读取myInfo,它位于myPendingIntent这可能吗?环顾Google,我得出的结论是,这是不可能的。

android - 无法将带有 PendingIntent 的 Bundle 发送到广播接收器,数据丢失

我正在通过使用AlarmManager和BroadcastReceiver类(名为AReceiver.java)向我的程序添加一些基本的警报功能。我的问题是我添加到附加到创建PendingIntent的Intent的包中的数据似乎丢失了。我可以在AReceiver类中访问的唯一包数据是android.intent.extra.ALARM_COUNT=1。下面是主Activity类中创建Intent、PendingIntent和AlarmManager的基本代码:[主要Activity中的代码-Notepadv3]Intentintent=newIntent(Notepadv3.this

android - 取消 PendingIntent

在AppWidgetProvider中使用PendingIntent时,我使用了以下代码:views.setOnClickPendingIntent(viewId,PendingIntent.getBroadcast(context,0,intent,PendingIntent.FLAG_UPDATE_CURRENT));因此,目前没有保留对getBroadcast方法返回的PendingIntent的引用。在特定情况下,我现在想取消PendingIntent。有没有办法从View中取回PendingIntent?还是通过保留对PendingIntent的引用来调用PendingInt

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 - 什么是 Android PendingIntent?

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