草庐IT

pendingintents

全部标签

android - PendingIntent 中的 TaskStackBuilder 不工作

我正在尝试为使用此代码按下通知的Activity重新创建返回堆栈:IntentfirstIntent=newIntent(this,First.class);IntentsecondIntent=newIntent(this,Second.class);TaskStackBuilderstackBuilder=TaskStackBuilder.create(this);stackBuilder.addNextIntent(firstIntent);stackBuilder.addNextIntent(secondIntent);PendingIntentpendingIntent=st

Android PendingIntent FLAG_NO_CREATE 不返回 null

我在使用PendingIntents时遇到了一些麻烦。每次打开我的应用程序时,它都会安排一些广播。我的问题是无法识别已经存在的PendingIntents。我知道必须使用相同的参数创建PendingIntents和底层Intents。她是我的代码...作为异步任务在我的启动器Activity中启动。longnextExecute=getNextExecute(t);if(nextExecute>System.currentTimeMillis()){inttt=12;intent=newIntent(context,BirthExecutor.class);intent.putExtr

android - Pendingintent getbroadcast lost parcelable data

问题来了。我的程序在Android6.0上运行完美。将设备更新到android7.0.Pendingintent无法将parcelable数据传递给boradcastreceiver。这是代码。拉响警报publicstaticvoidsetAlarm(@NonNullContextcontext,@NonNullTodotodo){AlarmManageralarmManager=(AlarmManager)context.getSystemService(context.ALARM_SERVICE);Intentintent=newIntent(context,AlarmReceiv

android - 当应用程序被删除时,PendingIntents 会发生什么?

正如标题所示,我很想知道Android如何处理已从设备中删除的应用程序创建的PendingIntents。到目前为止,我的研究涉及使用AlarmManager和未决Intent设置警报。在正常情况下,一切都按预期工作。为了测试卸载情况,我使用AlarmManager和PendingIntent为将来的某个时间点设置了一个警报,然后删除了该应用程序。我观察到的是,似乎没有任何事情发生-例如,logcat没有显示我的PendingIntent试图启动一个使用缺少的类的错误。我找不到这方面的文档,所以想知道是否有人知道这方面的知识或我可以引用的链接。 最佳答案

Android:如何从状态栏通知创建的 PendingIntent 访问 AsyncTask?

我的应用程序启动一个AsyncTask从URL下载文件。同时,它创建了一个状态栏Notification,告诉用户下载完成的百分比。我试图让我的应用程序响应点击通知。如果下载仍在进行中,我想显示一个DialogInterface,询问他们是否要停止下载。单击是应停止下载。我遇到的问题是我不确定如何从我为通知设置的PendingIntent访问我的异步任务。我可以很容易地显示DialogInterface,但我不确定如何显示正在停止下载的Activity。我尝试制作一个Helper类,它可以访问通知以及引用可下载文件的File对象,但我收到一条错误消息,指出该对象不可序列化(它确实实现了

android - 将 PendingIntent 中的小部件的额外内容传递给 Activity

我无法找到一种方法将附加组件从小部件正确传递到Activity。我不想在点击按钮时打开Activity并传递一些额外信息。Intentintent=newIntent(context,CreateOperationsActivity.class);intent.putExtra("someKey",true);PendingIntentpendingIntent=PendingIntent.getActivity(context,Constants.RequestCodes.CREATE_OPERATIONS,intent,PendingIntent.FLAG_UPDATE_CURRE

android - 启动器重启后 AppWidget PendingIntent 不工作

我有一个带有2个待处理Intent的AppWidget。他们大部分时间都在工作,但过一会儿他们就会停止响应。我唯一能够确定的是,在Launcher重新启动后它们会瘫痪,即我使用LauncherPro,有时会摆弄设置并不得不重新启动它。之后他们就完全不工作了。这是我的onRecieve()和onUpdate()方法:publicvoidonReceive(Contextcontext,Intentintent){super.onReceive(context,intent);Stringaction=intent.getAction();if(action.equals("android

android - 为结果启动 PendingIntent

我实现了ActivityX。我从ServiceS得到了一个PendingIntentP。我确定P指向unknownActivityY,它通过其setResult方法返回结果R。我应该如何在X中启动P,以便在X.onActivityResult中接收结果R? 最佳答案 GooglePlay服务使用PendingIntent对象来解决同一场景中的权限错误:IntentSenderintentSender=pendingIntent.getIntentSender();activity.startIntentSenderForResult

Android setFullScreenIntent() 在通知到达和手机锁定时执行 PendingIntent

AndroidsetFullScreenIntent()executethePendingIntentwhennotificationreachandphoneislocked.当我使用setFullScreenIntent()时遇到的奇怪问题它会执行PendingIntent,当我的手机被锁定时,当我解锁我的手机然后应用程序时,我已经设置为内容被打开。如果手机解锁并收到通知,它将在所有屏幕上将通知显示为顶部,并且不执行PendingIntent。有人遇到过这个问题吗?您的建议将不胜感激。下面是我的代码Intent_intent=newIntent(GcmIntentService.t

android - 如何获得已经挂起的 PendingIntent 的 Intent extra?

我已经用AlarmManager安排了一个PendingIntent。当AlarmManager传送Intent时,我能够getExtras()我最初发送的所有数据。但是,有时在AlarmManager触发之前,我会获得要通过Intent传递的额外数据。我的想法是,我会得到Intent就像我要取消它一样,但是在取消它之后,更新附加内容并使用AlarmManager重新安排它,就像这样:Intenti=newIntent(this,MyReceiver.class);Bundleb=i.getExtras();PendingIntentpi=PendingIntent.getBroadc