草庐IT

pendingintent

全部标签

android - 点击通知启动 Activity 两次

我正在使用以下代码从服务创建通知:NotificationManagernotificationManager=(NotificationManager)ctx.getSystemService(Context.NOTIFICATION_SERVICE);CharSequencetickerText="bla...";longwhen=System.currentTimeMillis();Notificationnotification=newNotification(R.drawable.icon,tickerText,when);IntentnotificationIntent=n

android - 第二个 Action 的 PendingIntent 会覆盖第一个 Action 和通知的 contentIntent

代码:intid=0;NotificationCompat.Builderbuilder=newNotificationCompat.Builder(context).setContentTitle(context.getString(R.string.notification_on_the_move_gps_title)).setContentText(context.getString(R.string.notification_on_the_move_text));builder.setStyle(newNotificationCompat.BigTextStyle().bigT

android - 单击android中通知中存在的按钮打开一个对话框

正如您在通知中看到的批准/拒绝按钮,我想打开一个对话框来确认用户输入而不打开任何Activity。这是我的代码,其中MyDialog是一个Activity,但我不想打开这个Activity,而是想打开一个对话框。publicvoidcreateNotification(Viewview){IntentyesIntent=newIntent(this,MyDialog.class);yesIntent.putExtra("NOTI_ID",NOTIFICATION_ID);yesIntent.putExtra("ACTION",1);PendingIntentyesPIntent=Pen

android - 获取有关 PendingIntent 的 Intent 的详细信息

我想知道是否可以从我自己未创建的PendingIntent中获取更多信息。更准确地说:是否有可能以某种方式检索PendingIntent的原始Intent?我不需要执行它,但想打印它的内容。查看PendingIntent的代码,它显示了一个隐藏的方法:/**@hide*/publicIIntentSendergetTarget(){returnmTarget;}然而,这个IIntentSender也是隐藏的,并且与Binder和更多IPC(我猜)相关的东西有关。没那么容易。有什么想法吗? 最佳答案 此方法适用于Android4.2.

Android:状态栏通知的点击事件

我有以下代码来创建状态栏通知:publicvoidtxtNotification(intid,Stringmsg){NotificationManagermanager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);Notificationnotification=newNotification(android.R.drawable.sym_action_email,msg,System.currentTimeMillis());//ThePendingIntentwilllaunchactivi

android - 从 PendingIntent(通知按钮)启动 JobIntentService?

在我的应用程序中,我有一个通知按钮,它使用IntentService在后台触发一个简短的网络请求。在这里显示GUI没有意义,这就是我使用服务而不是Activity的原因。请参阅下面的代码。//BuildtheIntentusedtostarttheNotifActionServiceIntentbuttonActionIntent=newIntent(this,NotifActionService.class);buttonActionIntent.setAction(NotifActionService.ACTION_SEND_CONFIRM);buttonActionIntent.

Android:使用 Context.startService 与 PendingIntent.getService 启动服务

Context.startServiceIntentintent=newIntent(context,MyService.class);context.startService(intent);PendingIntent.getServiceIntentintent=newIntent(context,MyService.class);PendingIntentpi=PendingIntent.getService(context,0,intent,0);pi.send();问题您何时会使用Context.startService与PendingIntent启动服务?你为什么要用一个而

android - 你能在本地广播中使用待处理的 Intent 吗?

我有兴趣在本地广播中使用挂起的Intent。为了清楚起见,我使用以下内容来注册接收器和发送广播:android.support.v4.content.LocalBroadcastManager。我在服务中有一个本地广播接收器可以正常工作。我正在尝试从包含可点击项目的自定义通知布局发送本地广播。本地广播接收器-只接收简单的ActionIntent。我正在尝试这样的事情无济于事:Intentbackintent=newIntent("GOTO_START_BROADCAST");PendingIntentbackIntent=PendingIntent.getBroadcast(getAp

java - Android - 使用标志 Activity 单击推送通知后打开或重新启动应用程序

我在Android中使用推送通知。当我收到推送通知时,如果应用程序仍在运行,我想打开它,否则它应该打开它的一个新实例。我正在使用PendingIntentcontentIntent=PendingIntent.getActivity(this,0,notificationIntent,Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP|Intent.FLAG_ACTIVITY_NEW_TASK);但是当我现在收到推送通知并点击它时,没有任何反应。我怎样才能通过使用flagIntents实现这一点?

java - 无法展开 RemoteViews - 错误通知

最近我收到了越来越多的用户报告RemoteServiceException错误。我每次得到的堆栈跟踪如下:android.app.RemoteServiceException:Badnotificationpostedfrompackagecom.smithyproductions.fasttracks:Couldn'texpandRemoteViewsfor:StatusBarNotification(pkg=com.smithyproductions.fasttracksid=311095tag=nullscore=0notn=Notification(pri=0contentVi