草庐IT

pendingintents

全部标签

android - 重新启动后,小部件 onUpdate 未在单击按钮时设置 pendingIntent

我正在创建一个测试小部件,通过单击它的按钮来显示随机数。一切都独立地在我的Provider的onUpdate中,包括pendingIntent。它工作正常,但在重新启动手机后views.setOnClickPendingIntent无法正常工作,尽管RemoteViews重新创建没有问题,但按钮变得无响应。publicclassTestWidgetextendsAppWidgetProvider{staticHashMapbr=newHashMap();staticvoidupdateAppWidget(Contextcontext,finalAppWidgetManagerappWi

android - pendingintent.getservice 无法正常工作

我正在尝试使用pendingintent启动服务,这就是我正在尝试的方式btnSave.setOnClickListener(newOnClickListener(){@OverridepublicvoidonClick(Viewv){//TODOAuto-generatedmethodstubInfoLayout.setVisibility(LinearLayout.VISIBLE);mIntentService=newIntent(MainActivity.this,LocationService.class);mPendingIntent=PendingIntent.getSer

Android - 什么是 PendingIntent?

我是Android开发的新手,我不得不使用AlarmManager重复闹钟。这是我第一次有机会使用PendingIntent的地方。然而,在阅读了文档(http://developer.android.com/reference/android/app/PendingIntent.html)之后,我真的很困惑PendingIntent到底是什么。我的问题是:Q1。PendingIntent以何种方式“待处理”?很抱歉这个问题,但我想对PendingIntent的含义有一个直观的理解。Q2。文档说:APendingIntentitselfissimplyareferencetoatoke

android - AlarmManager:PendingIntent 在某些设备上从最近的应用程序中刷过应用程序后消失了

简单的演示GitHub项目:https://github.com/Try4W/AlarmManagerDemo在模拟器上(Android4.1.1、Android6):我使用AlarmManager安排新的PendingIntent通过adbshelldumpsysalarm检查Activity警报查看我的Intent从最近使用的应用中滑动关闭应用通过adbshelldumpsysalarm检查Activity警报查看我的IntentBroadcastReciver及时触发!在我的设备上(乐视一号/Android6):我使用AlarmManage安排新的PendingIntent通过a

android - 您如何检测您的 Activity 是否由于您创建的 PendingIntent 而处于 onPaused 状态?

如果我有一个位于前台的Activity,并且我在我的应用程序中导航到另一个Activity,我可以通过在您开始传输时设置一个标志并在您传输到新Activity时删除它来检测到这一点。这使我能够区分由于内部(标志设置)或外部(标志未设置)事件导致的onPauseActivity。但是,我无法为通知中嵌入的PendingIntents执行此操作。是否有可能检测到我的Activity正在暂停,因为他们选择了我在通知栏上创建的通知?是否有某种我可以使用的通知监听器,它会在通知触发之前并执行暂停我的Activity的未决Intent?我明白这有点令人困惑,所以我制作了一个框架项目来演示这个问题:

安卓 : How to get PendingIntent id for canceling pendingintent

我一直在使用警报管理器。一旦我设置了一个PendingIntent来触发警报,我想取消它。HowdoIachievethis?帮助将不胜感激。 最佳答案 下面这几行代码肯定可以帮助您删除/取消挂起的Intent和警报。您需要的主要内容是:使用相同的ID和适当的intentFLAG创建待处理的intent。取消该未决Intent。使用警报管理器取消警报。IntentmyIntent=newIntent(PresentActivity.this,AlarmActivity.class);pendingIntent=PendingInte

android - AlarmManager.AlarmClockInfo中的PendingIntent在哪里使用?

TheconstructortoAlarmManager.AlarmClockInfo采用PendingIntent,描述为“可用于显示或编辑闹钟详细信息的Intent”。系统在哪里使用它?我在Android6.0UI中看不到任何似乎会触发该PendingIntent的内容。 最佳答案 PendingIntent由AlarmManager.AlarmClockInfo中的getShowIntent()返回:publicPendingIntentgetShowIntent(){returnmShowIntent;}它被用于Status

android - Notification、PendingIntent 和 Intent Flags 问题

(跳下以获得简短摘要)我在处理应用程序中的Activity顺序时遇到了问题。该应用程序有3个Activity,它们从A流向B再流向C(如果连续按下后退键,则从C流向B再流向A)。在正常操作中,该应用程序运行良好,我遇到的问题是收到C2DM通知时。收到通知后,我希望将PendingIntent发送到当前Activity的Activity,或者在应用未运行的情况下启动应用。在通知接收器中,无论当前Activity是什么(在Application类中保存)都会创建一个PendingIntent,这也可以正常工作。但是,当Activity与创建PendingIntent时使用的Activity

android - PendingIntent 的 onActivityResult

如何获取从NotificationManager启动的Activity的结果?换句话说,我需要从PendingIntent中获取resultCode。publicvoidtest(Contextcontext){Notificationnotification=newNotification(null,"text",System.currentTimeMillis());Intentintent=newIntent(Intent.ACTION_VIEW);intent.setData(Uri.parse("http://www.example.com"));PendingIntentp

android - PendingIntent.getBroadcast 无法解析

我正在androidstudio0.89中编写一个针对API级别20的小部件。在我的AppWidgetProvider中,我试图创建一个待处理的Intent来响应按下的按钮。我的问题是IDE无法识别PendingIntent中的任何方法。这是我的代码:@OverridepublicvoidonUpdate(Contextcontext,AppWidgetManagerappWidgetManager,int[]appWidgetIds){RemoteViewsviews=newRemoteViews(context.getPackageName(),R.layout.widdlewid