草庐IT

pendingintents

全部标签

android - 如何在 Intent 中将 PendingIntent 发送到我的服务

我想告诉我的服务在完成操作后要做什么。所以我想向服务发送一个PendingIntent,这样它就可以启动它(通过使用PendingIntent.send())PendingIntentpendingIntent;IntentnewInt;newInt=newIntent(Intent.ACTION_SENDTO);newInt.setData(Uri.parse("sms:052373"));newInt.putExtra("sms_body","TheSMStext");pendingIntent=PendingIntent.getActivity(this,0,newInt,0);

android - 通知 - 单击会触发错误的 PendingIntent

我有一个包含以下内容Intent的通知:clickIntent=PendingIntent.getService(getApplicationContext(),Constants.REQUEST_CODE_NOTIFICATION_OTHER,newIntent(getApplicationContext(),MainService.class).putExtra(Constants.EVENT,Constants.EVENT_TOGGLE_BLACK),PendingIntent.FLAG_UPDATE_CURRENT);和一个具有以下ActionIntent的Action:Pen

android - 使用 PendingIntent 传递数据

我正在尝试发出消息已到达的通知。我添加了一个Action,希望在通知中显示一个图标(smallredball)。我希望如果用户点击smallredball,主Activity将启动,并且Activity检查extras包,将看到执行与刚刚正常启动时不同的命令。通知与文本一起显示在目标手机(运行KitKat)上,但小红球图标从不显示。当用户触摸通知时,Activity执行时没有额外的。编辑:Activity现在获得额外的bundle。这是发送通知的代码:privatevoidraiseNotification(Stringusername,StringmesText){DebugLog.

android - 带有附加功能的地理围栏 PendingIntent

问题是:添加地理围栏的服务:publicclassGeofenceServiceextendsServiceimplementsGooglePlayServicesClient.ConnectionCallbacks,GooglePlayServicesClient.OnConnectionFailedListener,LocationClient.OnAddGeofencesResultListener,LocationClient.OnRemoveGeofencesResultListener{...@OverridepublicvoidonConnected(Bundlebund

android - 如何在 PendingIntent 中发送有序广播?

我想在PendingIntent中发送有序广播。但是我只找到了PendingIntent.getBroadcast(this,0,intent,0),我认为它只能发送常规广播。那么,我能做什么呢? 最佳答案 我从http://justanapplication.wordpress.com/tag/pendingintent-getbroadcast得到这个:IftheonFinishedargumentisnotnullthenanorderedbroadcastisperformed.所以你可能想尝试调用PendingIntent

android - 如何持久保存另一个应用程序提供的PendingIntent

假设我想实现一个向其他应用程序(如GooglePlay服务......)公开服务的应用程序。潜在的应用程序会注册到与我的服务相关的特殊事件,并会在正确的时间收到通知。我想像Google对GooglePlay服务所做的那样实现它:感谢Android进程间通信,其他应用程序可以绑定(bind)到我的应用程序Service,然后-传递给我的应用程序PendingIntent我可以执行的“回调”在合适的时间给他们。现在,我将解决问题:我的应用程序进程当前正在运行(在后台)并持有对其他应用程序提供的PendingIntent的引用。现在,出于某种原因(系统决策/用户明确)我的进程已停止。我的流程

Android PendingIntent 额外

我正在尝试从Android应用程序发送短信。我正在使用PendingIntent以便我可以使用BroadcastReceiver检查它是否发送正常。由于sendTextMessage调用将按SMS完成,我需要发送一些“额外”数据来识别实际的SMS,以便我的广播接收可以对特定的SMS消息做一些工作。这是我的发送代码:StringSENT="SMS_SENT";IntentsentIntent=newIntent(SENT);sentIntent.putExtra("foo","BAR");PendingIntentsentPI=PendingIntent.getBroadcast(bas

android - 对 PendingIntent.FLAG_CANCEL_CURRENT 文档的澄清

来自documentationofPendingIntentFLAG_CANCEL_CURRENT在安卓中:bycancelingthepreviouspendingintent,thisensuresthatonlyentitiesgiventhenewdatawillbeabletolaunchit.Ifthisassuranceisnotanissue,considerFLAG_UPDATE_CURRENT谁能解释一下这行是什么意思? 最佳答案 一旦您使用FLAG_CANCEL_CURRENT创建了一个新的PendingInt

android - 在 Appwidget 的一个 View 上使用两个 pendingIntent

我有一个小部件类(扩展AppWidgetProvider),它在小部件的布局中只有一个View(ImageView)。当用户点击小部件时,它会毫无问题地更新和启动Activity。此外,小部件每30分钟更新一次,并在小部件更新后启动Activity。我的问题是:如何将小部件配置为仅在自动更新(而不是通过用户点击)时更新自身?这是我的代码:publicclassWidgetextendsAppWidgetProvider{privatestaticfinalStringACTION_UPDATE=AppWidgetManager.ACTION_APPWIDGET_UPDATE;@Over

android - 如果将 PendingIntent 上的标志设置为 0 会发生什么情况?

当您将待处理Intent上的标志设置为0时,究竟会发生什么?它只是不升起一个标志还是默认为其他标志之一? 最佳答案 不,这是创建新PendingIntent的“默认”行为,无论它是否已经存在。如果您想要更专业的行为,例如在底层Intent相同时取消现有的PendingIntent,或者更新此类现有的PendingIntent,那么您应该使用您可以在PendingIntent类中找到的各种标志。 关于android-如果将PendingIntent上的标志设置为0会发生什么情况?,我们在S