草庐IT

notificationManager

全部标签

java - 找不到符号 NOTIFICATION_SERVICE?

packagecom.test.app;importandroid.app.Notification;importandroid.app.NotificationManager;importandroid.app.PendingIntent;importandroid.content.BroadcastReceiver;importandroid.content.Context;importandroid.content.Intent;publicclassrunOnBootextendsBroadcastReceiver{@OverridepublicvoidonReceive(Co

android - notificationManager 通过 Id 获取通知

有谁知道有什么方法可以通过id获取通知吗?如果它仍然显示在Android的状态栏中,我想要在收到新通知时想要获取信息并将其添加到新通知中。谢谢。 最佳答案 NotificationManager不会为您提供按ID查找现有通知的方法。如果您想更新通知,请发布新通知但使用相同的ID。它将显示为新通知或使用该ID更新现有通知。 关于android-notificationManager通过Id获取通知,我们在StackOverflow上找到一个类似的问题: http

android - 当我的 Android 应用程序处于前台时,我想隐藏其他应用程序的所有通知。这可能吗?如何?

我正在创建一个教育应用程序,学生可以在其中进行5分钟的快速考试。他们大部分时间都在使用parent的手机。现在我想要的是,当学生参加考试时,任何其他应用程序(如WhatsApp、FB或Gmail)都不应发出通知。这可能吗?如何? 最佳答案 一种可能的解决方案是将手机设置为DND(请勿打扰)模式。我没有对此进行测试,但根据您应该能够执行的文档:NotificationManagernotificationManager=(NotificationManager)getSystemService(Context.NOTIFICATION

android - 如何在 Android 应用程序( Activity 或服务)被终止时删除所有通知?

我有一个应用在后台运行一个Activity和一个Intent服务。还有一个通知显示后台进程的进度条(它正在从服务器下载大量文件)。Activity显示下载进度(在下载这些Assets之前,用户无法有意义地使用该应用程序)。当此Activity关闭时,会显示带有进度条的通知。我的问题:当应用程序通过“任务管理器”(在android4.0上通过右键访问,带有两个矩形的那个)被终止时,通知仍然存在。但它基本上是一个僵尸,因为用来更新它的服务已经死了。换句话说:当我的应用程序被终止时,我如何删除一个(或所有)通知? 最佳答案 @看publi

android - 如何设置通知的点击监听?

我正在使用以下代码在通过AlarmManager启动服务时启动通知:nm=(NotificationManager)this.getSystemService(Context.NOTIFICATION_SERVICE);CharSequencefrom="App";CharSequencemessage="GettingLatestInfo...";PendingIntentcontentIntent=PendingIntent.getActivity(this,0,newIntent(),0);Notificationnotif=newNotification(R.drawable.

android - 如何设置通知的点击监听?

我正在使用以下代码在通过AlarmManager启动服务时启动通知:nm=(NotificationManager)this.getSystemService(Context.NOTIFICATION_SERVICE);CharSequencefrom="App";CharSequencemessage="GettingLatestInfo...";PendingIntentcontentIntent=PendingIntent.getActivity(this,0,newIntent(),0);Notificationnotif=newNotification(R.drawable.

android - 如何检测通知是否已被驳回?

Android中是否有任何方法可以检测用户何时向左滑动通知并将其删除?我正在使用警报管理器设置重复警报,并且当用户取消通知时,我需要停止重复警报。这是我的代码:设置重复提醒:AlarmManageralarmManager=(AlarmManager)getSystemService(ALARM_SERVICE);alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,c.getTimeInMillis(),repeatFrequency,displayIntent);我的通知代码:@OverridepublicvoidonCreate(Bu

android - 如何检测通知是否已被驳回?

Android中是否有任何方法可以检测用户何时向左滑动通知并将其删除?我正在使用警报管理器设置重复警报,并且当用户取消通知时,我需要停止重复警报。这是我的代码:设置重复提醒:AlarmManageralarmManager=(AlarmManager)getSystemService(ALARM_SERVICE);alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,c.getTimeInMillis(),repeatFrequency,displayIntent);我的通知代码:@OverridepublicvoidonCreate(Bu

Android NotificationManager 给我 "no valid small icon"错误

通知管理器出现一个奇怪的错误。@OverridepublicvoidonMessageReceived(Stringfrom,Bundledata){Log.i(TAG,"IP:"+(String)data.get("ip"));NotificationManagernotificationManager=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);IntentacceptNextIntent=newIntent(MainActivity.BROADCAST_KEY_ACCEPT);//acceptNextIn

Android NotificationManager 给我 "no valid small icon"错误

通知管理器出现一个奇怪的错误。@OverridepublicvoidonMessageReceived(Stringfrom,Bundledata){Log.i(TAG,"IP:"+(String)data.get("ip"));NotificationManagernotificationManager=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);IntentacceptNextIntent=newIntent(MainActivity.BROADCAST_KEY_ACCEPT);//acceptNextIn