草庐IT

pendingintents

全部标签

android - 使用 PendingIntent 显示对话框

我正在处理日历事件提醒。Android中没有原生日历事件提醒,因此用户需要安装不同的日历应用。现在这些应用程序可以在提醒事件上有所不同,比如可以显示提醒通知。现在我想在这些事件日历应用程序中以编程方式设置一个事件,并且在到达时间时不显示任何通知,而是会显示一条弹出消息,并带有类似声音的警报。那时我使用了那个网站的代码。它可以正常工作,但会以通知的形式显示提醒。代码如下:接收时voiddoReminderWork(Intentintent){LongrowId=intent.getExtras().getLong(RemindersDbAdapter.KEY_ROWID);Notific

android - New PendingIntent 更新当前 Intent

我试图在一段时间间隔后显示不同的通知,但发生的事情是它用新的通知更新当前的PendingIntent结果我只收到一个通知,即使我触发4-5pendingIntent请求点击按钮我做了以下事情try{adapter.OpenDB();intid=adapter.getMaxId("reminder")+1;adapter.CloseDB();Intentintent=newIntent(MilestonesActivity.this,AlarmReceiver.class);intent.putExtra("message",""+editMsg.getText()+""+editDat

Android:如果将 Activity 带回屏幕,Notification 的 PendingIntent 不会触发 onCreate()

我猜我对IntentFlags有一些误解。我想做的是,我有一个radio流应用程序,它有两个Activity(PlayerApplication和SettingsScreen)。我有一个在后台运行的用于流媒体的Service.class,它也包含一个通知(您可以在通知覆盖菜单和PlayerApplication中停止/开始播放)。如果用户点击通知,PlayerApplicationActivity应该返回屏幕。一切正常,预期情况:用户打开SettingsScreenActivity->打开NotificationOverlayMenu->点击Notification->PendingI

android - Android Geofences 是否保持 Activity 状态直到删除/过期或仅直到我的 PendingIntent 启动

我即将使用地理围栏实现一项功能,在我完成任何认真的工作之前,我需要知道地理围栏在第一次转换后是否保持Activity状态。该功能的核心是:everytimeI'mwithinxmetersofpointP(callthisAreaA),IwantActionBtooccur.我需要知道的是我是否只需要使用Geofence.NEVER_EXPIRE添加一个地理围栏,然后放心,我每次都会收到PendingIntent我输入指定区域,无论耗时、重新启动等或我是否必须在离开A区后重新注册此地理围栏,以便在我下次进入A区时收到通知?我希望是前者 最佳答案

android - PendingIntent 获取请求代码

我使用AlarmManager来启动服务。当我设置AlarmManager时,我使用PendingIntent并使用一个唯一的requestCode,它等于我数据库中的一个id行。PendingIntentpendingIntent=PendingIntent.getBroadcast(SettingsActivity.this,lecture.getId(),myIntent,0);我如何在服务启动时在我的服务中检索该ID?我基本上只需要requestCode参数。我想使用该ID从我的数据库中检索数据并将其显示在通知中。我已经实现了所有的东西,我只需要那个requestCode。有可

android - NotificationCompat.Builder 是否需要 setContentIntent(PendingIntent)?

调用:publicstaticvoidtriggerTestNotification(Contextctx,Stringtag,intid){Notificationnot=newNotificationCompat.Builder(ctx).setContentTitle("Title").setContentText("Text").setAutoCancel(true)//cancelonclick.setSmallIcon(R.drawable.ic_launcher).build();NotificationManagernotificationManager=(Notifi

android - 取消 AlarmManager 的问题 - PendingIntent

我有一个应用程序可以提醒人们完成他们的任务。所以有一个PendingIntent,现在用户可以随时删除警报。在此代码中,多个用户警报只有一个PendingIntent,因此我对取消intentextras为"pill"的特定警报感到困惑。不应取消剩余的警报。我对这个问题一无所知。希望我清楚。谢谢Intentintent=newIntent(this,AlarmNotifyReceiver.class);intent.putExtra("Name_pill","pill");sender=PendingIntent.getBroadcast(this,DatabaseConstants.

android - 启动和停止服务的 PendingIntent

我正在尝试制作一个带有按钮的简单小部件,该按钮使用OnClickPendingIntent()启动Service。我可以很好地启动它,但我想不出停止它的方法(我知道我可以使用BroadcastReceiver或类似的东西来做到这一点,但我想避免硬编码)。这是我的代码:Intentintent=newIntent(context,myService.class);PendingIntentpendingIntent=PendingIntent.getService(context,0,intent,0);RemoteViewsviews=newRemoteViews(context.ge

android - PendingIntent 错误(必须是 : PendingIntent. FLAG_ONE_SHOT 中的一个或多个......)

我正在尝试在Android中创建一个PendingIntent。这是代码mNotificationIntent=newIntent(getApplicationContent(),MyAlarm.class);mContentIntent=PendingIntent.getActivity(getApplicationContext(),0,mNotificationIntent,Intent.FLAG_ACTIVITY_NEW_TASK);我收到以下错误:Mustbeoneormoreof:PendingIntent.FLAG_ONE_shot,PendingIntent.FLAG_

android - AlarmManager.AlarmClockInfo 的 PendingIntent 是如何工作的?

我正在尝试使用AlarmManager.AlarmClockInfo设置闹钟。此构造函数需要时间和PendingIntent,在文档中描述为:anintentthatcanbeusedtoshoworeditdetailsofthealarmclock.然后setAlarmClock()也接受了一个未决的Intent,它在文档中被描述为:Actiontoperformwhenthealarmgoesoff我了解setAlarmClock()使用PendingIntent,但是AlarmClockInfo如何使用PendingIntentcode>以及如何使用它来编辑闹钟的详细信息?