草庐IT

pendingintents

全部标签

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 - 获取有关 PendingIntent 的 Intent 的详细信息

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

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启动服务?你为什么要用一个而

pendingIntent.getBroadcast在“通知抽屉”中不做默认通知/触摸事件-Android Studio 2.3.3 + Java

我已经通过pendingIntent.getBroadcast将通知操作处理程序连接到了通知中的操作。操作正常工作,当我使用默认点击事件上的通知时,它可以正常工作。当通知在托盘中时,我的问题就到了,我在抽屉中还有其他通知,我正在尝试对通知上的默认点击/触摸事件编程,以广播到接收器并运行操作。这是一些代码:UrialertSound=Uri.parse("android.resource://"+ctx.getPackageName()+"/raw/page_the_doctor");NotificationCompat.BuildernotificationBuilder=newNotific

【已解决】Android12以上PendingIntent需要强制增加FLAG_IMMUTABLE或FLAG_MUTABLE

Android13适配时报下面错误:java.lang.IllegalArgumentException:android:TargetingS+(version31andabove)requiresthatoneofFLAG_IMMUTABLEorFLAG_MUTABLEbespecifiedwhencreatingaPendingIntent.02-2620:00:47.0552782127821ISystem:java.lang.IllegalArgumentException:android:TargetingS+(version31andabove)requiresthatoneofF

android - 使用 PendingIntent 的应用程序小部件中的 Oreo 服务未启动

我正在使用Android应用小部件。我正在创建一个PendingIntent对象并在方法RemoteViews#setOnClickPendingIntent()中使用它。这是待定Intent://ThebelowcodeiscalledintheonUpdate(Context,AppWidgetManager,int[])methodoftheAppWidgetProviderclass.//ExplicitintentIntentintent=newIntent(context,MyService.class);intent.setAction(MY_ACTION);intent

android - 使用 PendingIntent 的应用程序小部件中的 Oreo 服务未启动

我正在使用Android应用小部件。我正在创建一个PendingIntent对象并在方法RemoteViews#setOnClickPendingIntent()中使用它。这是待定Intent://ThebelowcodeiscalledintheonUpdate(Context,AppWidgetManager,int[])methodoftheAppWidgetProviderclass.//ExplicitintentIntentintent=newIntent(context,MyService.class);intent.setAction(MY_ACTION);intent

android - 如何通过 PendingIntent 发送数据到广播?

我正在尝试通过PendingIntent发送一些额外的数据,例如:MyMessagemessage;//...Intentintent;SmsManagersms=SmsManager.getDefault();intent=newIntent(Constants.SENT_PLAIN);intent.putExtra(Constants.EXTRA_RAW_ID,message.getId());//puttinglongid(not-1L)PendingIntentsentPI=PendingIntent.getBroadcast(activity,0,intent,0);inte

android - 如何通过 PendingIntent 发送数据到广播?

我正在尝试通过PendingIntent发送一些额外的数据,例如:MyMessagemessage;//...Intentintent;SmsManagersms=SmsManager.getDefault();intent=newIntent(Constants.SENT_PLAIN);intent.putExtra(Constants.EXTRA_RAW_ID,message.getId());//puttinglongid(not-1L)PendingIntentsentPI=PendingIntent.getBroadcast(activity,0,intent,0);inte