This is a class which helps create notification for you app. Import Statement for NotificationManager class android.app.NotificationManager
Questions tagged [notificationmanager]
233 questions
41
votes
4 answers
Android NotificationManager giving me "no valid small icon" error
I am having a strange error with notification manager.
@Override
public void onMessageReceived(String from, Bundle data)
{
Log.i(TAG, "IP : " + (String) data.get("ip"));
NotificationManager notificationManager = (NotificationManager)…

mrQWERTY
- 4,039
- 13
- 43
- 91
40
votes
1 answer
Multiple notifications to the same activity
I have an activity that is being opened from the notification bar, but when I do NotificationManager.notify(...), I'm giving to the intent a different bundle, so that each notification opens the same activity, but obtaining from the DB other…

Daniel
- 401
- 1
- 4
- 3
38
votes
3 answers
Android - notification manager, having a notification without an intent
I would like to be able to fire a notification to alert the users about a timer that has finished, however i do not wish to have an intent when you click the notification.
I've tried passing in null for the intent
String ns =…

Garbit
- 5,805
- 6
- 39
- 72
32
votes
3 answers
How to set click listener for notification?
I am using the following code to launch a notification when a Service is started Via AlarmManager:
nm = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
CharSequence from = "App";
CharSequence message = "Getting Latest…

yoshi24
- 3,147
- 8
- 45
- 62
32
votes
2 answers
How to properly clear all notification once clicked?
I send a few notification on the notification bar, i wanted to clear all of it when one of the notification is clicked. For now I clear one by one by using Flag. I know notificationManager.cancelAll() could clear all the notification but where…

Eric
- 1,547
- 2
- 18
- 34
27
votes
3 answers
How to detect if a notification has been dismissed?
Is there any way in Android to detect when a user swipes a notification to the left and deletes it? I'm using an alarmmanager to set a repeating alert and I need my repeating alert to stop when the notification is cancelled by the user. Here's my…

NewGradDev
- 1,004
- 6
- 16
- 35
26
votes
2 answers
How to use notification with sound and vibration?
How do you allow the device to vibrate or make a sound when a notification is launched.
Ive heard of the FLAGS. But how would i use them for Sound and Vibration?

yoshi24
- 3,147
- 8
- 45
- 62
16
votes
7 answers
NotificationManager.cancel(id) is not working inside a broadcast receiver
Android: I am trying to cancel a notification from the notification bar after a package being installed.
What I am doing is the following:
public class MyBroadcastReceiver extends BroadcastReceiver {
private static final String TAG =…

b.i
- 1,087
- 4
- 22
- 43
15
votes
0 answers
The Animation-list restart when I update (NotificationManager.notify) notifications on Lollipop
I have implemented a notification that contains an animation when my app downloads a file, it was working perfectly until Lollipop appeared.
public void createNotification(String filename) {
mBuilder = new Notification.Builder(this);
…

cgr
- 519
- 1
- 7
- 20
15
votes
6 answers
Add a new notification when push notification is received (not replace the previous)
I am using push notifications in my app. I need to display a notification when a push notification delivered. If I send another notification (without clearing the previous notification), it will replace the old notification.
This is the code I…

gouthaman93
- 290
- 4
- 19
14
votes
2 answers
NotificationManager getActiveNotifications() for older devices
I want to be able to get active notifications from my Android app on demand. (actually I just need to know if there are any)
I've been searching for this behavior and it seems, like I have only two options:…

niosus
- 738
- 8
- 22
14
votes
2 answers
android memory leak in notification service
I have a service which creates a notification and then updates it with certain information periodically. After about 12 mins or so the phone crashes and reboots, I believe it is caused by a memory leak in the following code to do with how I am…

stealthcopter
- 13,964
- 13
- 65
- 83
13
votes
6 answers
Cannot find symbol NOTIFICATION_SERVICE?
package com.test.app;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class…

mrburns
- 453
- 1
- 8
- 17
13
votes
2 answers
What's "AutomaticZenRule" ? What is it used for?
Background
I just noticed some functions of NotificationManager that handle a class that's called AutomaticZenRule :
https://developer.android.com/reference/android/app/NotificationManager.html#addAutomaticZenRule(android.app.AutomaticZenRule)
and…

android developer
- 114,585
- 152
- 739
- 1,270
13
votes
3 answers
StatusBarNotification how to get data or resend intent?
My Apps receives Push Notification via Firebase. Now there a 3 distinct situations that can happen when the notification arrives:
The app is in the foreground
The app is in the background
The app is not running
Situation 1 is no problem. The…

Paul Sinnema
- 2,534
- 2
- 20
- 33