草庐IT

pendingintents

全部标签

BroadcastReceiver 未收到 Android PendingIntent 额外内容

当我将附加信息传递给PendingIntent时,sendBroadcastReceiver永远不会收到消息,因为永远不会调用此BroadcastReceiver的onReceive()方法。为什么会这样?publicclassMainActivityextendsActivity{privatestaticStringSENT="SMS_SENT";privatestaticStringDELIVERED="SMS_DELIVERED";privatestaticintMAX_SMS_MESSAGE_LENGTH=160;privatestaticContextmContext;pr

android - 是否有必要在 Notification 的 PendingIntent 中使用 FLAG_ACTIVITY_NEW_TASK?

我使用Notification有一段时间了,昨天我注意到PendingIntent的文档说传递给PendingIntent.getActivity()的Intent方法必须设置FLAG_ACTIVITY_NEW_TASK:Notethattheactivitywillbestartedoutsideofthecontextofanexistingactivity,soyoumustusetheIntent.FLAG_ACTIVITY_NEW_TASKlaunchflagintheIntent.但是,我在使用Notification时从未设置过这个标志,但到目前为止我还没有遇到任何问题。

android - Geofences 不触发(pendingintents 和 broadcastreceiver)

我已经将Android教程与Geofences一起使用,显然,当应用程序关闭时它不起作用。因此,在四处搜索之后,我注意到SO上的用户b-ryce使用了BroadcastReceiver,因此即使应用程序未处于Activity状态(linkforhisSOquestion)也会触发地理围栏。当我移出/移入注册位置时,我无法强制触发地理围栏。这是我的程序:/***GeoLocationlibrary*/mGeoLocation=newGeoLocation(sInstance);/***mReceiverinit*/mReceiver=newReceiver();sInstance.reg

android - 当用户更新应用程序时,PendingIntents 会发生什么?

我知道当用户更新他的应用程序时,数据(如共享首选项文件中的数据)不会被删除,但是预定的广播呢?PendingIntent是否被取消? 最佳答案 PendingIntent不会在应用更新时被取消或删除。如果您在更新前安排了警报,这些警报将在更新后的预期时间触发。但是,如果您卸载应用程序,所有PendingIntent、警报、私有(private)数据、数据库等都将被取消/删除。 关于android-当用户更新应用程序时,PendingIntents会发生什么?,我们在StackOverfl

android - 点击 bundle 通知不会触发 PendingIntent

因此,在牛轧糖中,来自同一应用的多个通知会自动bundle到一个组中。我在我的通知上设置了一个PendingIntent和一些额外的东西,如果点击了一个特定的通知,它会启动一个特定的Activity(深层链接)。但是,如果我点击通知包(即不展开组),我的应用程序就像从启动器中一样简单地启动-即它的Intent是空的,没有额外的东西(它不是通过提供的启动器启动的)待定Intent)。当用户点击通知包时,我如何指定要使用的Intent? 最佳答案 我遇到了同样的问题,经过一些调查,您似乎无法设置PendingIntent以在Androi

android - AlarmManager 过早触发 PendingIntent

我已经搜索了3天,但没有在其他任何地方找到解决方案或类似的问题/问题。这是交易:1小时内触发->工作正常2小时内触发->1:23内触发1天内触发->~11:00内触发那么为什么AlarmManager如此不可预测并且总是来得太快?或者我做错了什么?还有其他方法可以使其正常工作吗?这是我在AlarmManager中注册PendingIntent的方式(简化):AlarmManageralarmManager=(AlarmManager)parent.getSystemService(ALARM_SERVICE);IntentmyIntent=newIntent(parent,Update

android - 一直支持PendingIntent中的requestCode吗?

我试图通过为每个用例设置单独的requestCode来区分PendingIntent的不同实例,正如this所建议的那样较早的问题。这是一个可靠的解决方案吗?即使javadocs是否始终支持requestCode还说“目前没有使用”? 最佳答案 是的。requestCode一直都在那里。目前,Android框架除了作为PendingIntent匹配测试的一部分外,它不用于执行任何操作。使用requestCode来确定不同的PendingIntent是可靠且受支持的。documentation甚至这样说:如果您确实需要同时激活多个不同

android - FusedLocationApi 与 PendingIntent 用于后台位置更新。无法接收更新

来自google的示例源代码很容易在前端实现连续位置更新,但我仍然无法清楚地了解或理解后台位置更新如何使用FusedLocationApi和PendingIntent。LocationService类:publicclassLocationServiceextendsIntentService{privatestaticfinalStringTAG=LocationService.class.getSimpleName();privatestaticfinalStringACTION_LOCATION_UPDATED="location_updated";privatestaticfi

Android 后台堆栈不是从 Notification PendingIntent 创建的

如果遵循通知时应用程序不在内存中,我会遇到问题。不会创建后台堆栈。我已经按照开发人员指南执行了这些步骤。请告诉我我错过的一点,否则我将不得不通过我的HomeActivity路由所有Intent,以便根据以下Intent手动创建后台堆栈。AndroidManifest.xml:建筑通知:finalStringchatId=cursor.getString(cursor.getColumnIndexOrThrow(MessageColumns.CHAT));finalIntentchat=newIntent(c,ChatActivity.class);chat.putExtra(ChatA

java - 查看AlarmManager中现有PendingIntent的时间

是否可以查询AndroidAlarmManager以获取给定PendingIntent的下一次闹钟时间?我知道我可以使用.cancel(PendingIntent)函数取消一个,我可以使用.set()更新一个,但是是否可以“查询”一个?我用这样的东西来查看是否已经安排好了:PendingIntentsender=PendingIntent.getBroadcast(context,0,intent,PendingIntent.FLAG_NO_CREATE);如果sender==null,则已经安排了一个。我真的很想知道“什么时候?”如果可能的话。我知道我可以在设置它时将它保存在数据库或