Questions tagged [android-notifications]

A status notification adds an icon to the system's status bar (with an optional ticker-text message) and a notification message in the notifications window.

A notification is a user interface element that you display outside your app's normal UI to indicate that an event has occurred. Users can choose to view the notification while using other apps and respond to it when it's convenient for them.

Think of notifications as a news channel that alerts the user to important events as they happen or a log that chronicles events while the user is not paying attention. The user can expand the notification bar and by selecting the notification the user can trigger another activity. Notifications in Android are represented by the Notification class. To create notifications you use the NotificationManager class which can be received from the Activity via the getSystemService() method.

Useful links

4920 questions
12
votes
2 answers

How to find which apps are allowed under "Priority app notifications" within Do Not Disturb setting?

I am trying to programmatically find out for which apps the Do Not Disturb setting is bypassed exceptionally. So far, I am using the following code to check whether the phone is set in Do not Disturb mode or not : public static boolean…
SoulRayder
  • 5,072
  • 6
  • 47
  • 93
12
votes
3 answers

Android FCM notification grouping

I was trying to implement FCM notification for a chat app and I want to achieve "WhatsApp-like" notification where the notification will be grouped by conversation. Say when Alice replied to a conversation with Bob inside, Bob will receive a…
12
votes
2 answers

Get Android notification panel width

I'm creating some custom remoteViews, In order to draw custom views and layouts to a bitmap as wide as the notification panel I need its exact width. As every vendor changes the width of the notification panel and in most cases it will changes based…
12
votes
2 answers

How to show Android Notifications on screen as well as status bar icon?

I feel like this should be trivial but I can't seem to make a notification show up on the phone's screen - it only shows up in the status bar at the top. For an example of what I want to do, here's how Facebook Messenger shows up on the screen when…
Andrew Cross
  • 1,921
  • 2
  • 19
  • 32
12
votes
2 answers

how to set NAVIGATION_MODE_LIST on Toolbar new appcompat v7 21

Now all methods related to navigation modes in the ActionBar class, such as setNavigationMode()... are now deprecated. The documentation explains: Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider…
12
votes
2 answers

How to show different icons for status bar and notification bar in Android?

I'm creating android notification according to android documentation. I used large icon and small icon for Notification bar. In this case small icon is showing on both status bar and notification bar . I want to show different icons for status bar…
james
  • 1,967
  • 3
  • 21
  • 27
12
votes
5 answers

Android Wear Specific Notification

The WearableNotifications.Builder setLocalOnly method can be used for displaying a notification on a phone only, and not mirror it to a Wear device. Is there a way to do the opposite, so creating a notification that will display only on the Wear…
Steve
  • 53,375
  • 33
  • 96
  • 141
12
votes
3 answers

Android - updating notification progress bar, properly

I am still really new to Android and I am trying to improve my notification's progress bar to be smoother, not fire a million updates to my Pebble and do it the "right way". This code works "fine" as in when I am using it, the notification draws and…
Jayrox
  • 4,335
  • 4
  • 40
  • 43
12
votes
2 answers

Turn off notifications of an app programatically on Android

I am developing a package manager application which shows checkboxes to turn off notifications from different applications installed on the Android device. Since Android 4.1, users can turn off notifications of an app from application manager. Can…
Gopinath
  • 12,981
  • 6
  • 36
  • 50
12
votes
2 answers

Android: Does Notification.DEFAULT_VIBRATE require vibrate permission?

Sometimes I read that notification.defaults|= Notification.DEFAULT_VIBRATE; and notification.defaults = Notification.DEFAULT_ALL; requires the vibrate permission But…
Xander
  • 5,487
  • 14
  • 49
  • 77
12
votes
1 answer

android Notification doesnt trigger BroadcastReceiver's onReceive

Is it possible to have a notification start a broadcast receiver? I tried this code but it doesnt work. Notification is created but when I click on it nothing happens. NOTE: When I change the notificationIntent to point from…
Abhishek
  • 1,749
  • 9
  • 27
  • 39
12
votes
3 answers

Fragments and Notifications: Target different Activities from Notification; depending on screen configuration

Question: How to decide what Activity a Notification should launch if the target might depend on the configuration (screen size, orientation etc); as is often the case when one uses Fragments? Details: Let's consider the NewsReader sample that…
curioustechizen
  • 10,572
  • 10
  • 61
  • 110
11
votes
1 answer

How to dismiss notification since Android 12?

My app creates a notification with two actions the user can choose. After choosing either of the actions, I want the notification to be automatically dismissed. Until now I achieved that by having this at the end of onReceive from my…
Leandro 86
  • 157
  • 1
  • 9
11
votes
3 answers

How to count number of notification and display single icon in Android?

I have multiple Android notification, but when I send a message from my web server, the android device creates a new notification icon on status bar. I want to count the number of unread notification, display it on statusbar with single icon, and…
11
votes
2 answers

ExoPlayer Notification Manager, hide fast rewind and fast forward buttons

I am trying to implement ExoPlayer's Notification Manager, it works pretty well but I do not want to show fast rewind and fast forward buttons. I checked documentation but can not find a way to hide these button. Is there any tricky way to hide…
ysfcyln
  • 2,857
  • 6
  • 34
  • 61