草庐IT

Pendingintent

全部标签

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

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

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如何取消AlarmManager.setAlarmClock()

有这个newAlarmManager.setAlarmClock(...)method在API21中,它设置一个新的警报并显示一个状态栏警报图标。我是这样使用的:AlarmManageram=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);Intentintent=newIntent(ALARM_ALERT_ACTION);PendingIntentsender=PendingIntent.getBroadcast(context,0,intent,PendingIntent.FLAG_CANCEL_CURRE

android - 如何安排本地通知 Android?

我对Android中的本地通知有疑问。我正在开发一个应用程序,在第一部分我必须接收我自己的服务器公司的所有session(我已经实现),第二部分我必须在每次session前一天通知,但有本地通知。如何在给定日期安排本地通知? 最佳答案 要安排本地通知,您需要了解一些用于安排通知的内容,例如:BroadcastReceiversIntentFilters报警管理器通知服务PendingIntent在MainActivity中执行以下操作:@OverrideprotectedvoidonCreate(BundlesavedInstanc

android - 使用 PendingIntent 传递数据

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

android - Android 小部件的两个按钮以不同的 Intent 调用相同的 Activity

我在Android中有一个带有两个按钮的主屏幕小部件。两个按钮都应该调用相同的Activity(类),只是使用不同的Intent加上Intent附加功能,以了解哪个按钮调用了该类。目前只有button1正在工作并调用该Activity。我还在调用的Activity中收到键值。如何让第二个按钮起作用?这是我的代码:publicvoidonUpdate(Contextcontext,AppWidgetManagerappWidgetManager,int[]appWidgetIds){super.onUpdate(context,appWidgetManager,appWidgetIds)

Android 通知操作 - Intent Extra 未按预期工作

我正在创建一个包含多个操作的通知。我正在使用broadcastintents来传达一个已被推送并采取特定行动。有4个按钮,我创建了4个独立的Intent。每个都有相同的Action字符串,但StringExtra不同。IntentintNow=newIntent(mThis,MyReceiver.class).setAction(actionNotify).putExtra("button",ACT_NOW);IntentintEmail=newIntent(mThis,MyReceiver.class).setAction(actionNotify).putExtra("button

android - 第二次通知无效

我尝试创建多个通知。如果单击通知,它将链接到另一个Activity。在遵循代码之后,它创建了两行通知。但是当我点击通知的第一行时,它不起作用。只有第二个作品。for(inti=0;i所以,请帮我找出我的错误。非常感谢。 最佳答案 您应该使用不同的请求代码创建PendingIntent。改变这个:PendingIntentintent=PendingIntent.getActivity(ApplicationMenus.this,0,notifyIntent,android.content.Intent.FLAG_ACTIVITY_N

android - 在状态栏中显示通知文本 - Android

在我的应用程序中,我需要向用户显示通知。以下代码fragment非常适合在Android设备标题栏中显示图标和内容标题。varnotificationManager=GetSystemService(Context.NotificationService)asNotificationManager;varuiIntent=newIntent(this,typeof(MainActivity));varnotification=newNotification(Resource.Drawable.AppIcon,title);notification.Flags=NotificationF