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
52
votes
3 answers

NotificationChannel issue in Android O

I am getting a toast saying "Developer warning for package com.google.android.apps.messaging" when sending an MMS using Android Messages ver 2.3.063. In logs 08-12 16:57:52.368 7661 7682 W Notification: Use of stream types is deprecated for…
Shabbir Panjesha
  • 1,851
  • 5
  • 20
  • 29
52
votes
11 answers

How to show a notification without a sound java

How can I make a notification that doesn't make a sound when I build it? I am building a notification, and my users don't like the fact that it makes a sound. How can I change it to a silent one / no sound at all? How I show…
Jason
  • 1,658
  • 3
  • 20
  • 51
52
votes
8 answers

How do I check whether my app is allowed to post notifications?

Users can turn off notifications for individual apps in Android settings. Is there a method like isNotificationsAllowed() that allows me to check whether my app is allowed to post notifications? Also, how do I open the Android settings screen to…
Yunpeng Lee
  • 545
  • 1
  • 4
  • 6
49
votes
8 answers

Cancel notification on remove application from multitask panel

I manage an ONGOING notification from my application (not from a service). When I kill application from task manager with "End" button, notification disappear. When I remove application from multitask pannel, application is killed but notification…
alex
  • 5,661
  • 6
  • 33
  • 54
48
votes
6 answers

How To give notifications on android on specific time?

I want to give notification to my app on a specific time. Say everyday i have to give notification on 7 AM even if the app is closed. How can i do this? Any tutorial? Please mention the link.
admin 7798
  • 697
  • 1
  • 7
  • 15
47
votes
15 answers

Bad notification posted - Couldn't expand RemoteViews for: StatusBarNotification

I am trying to post a notification with a custom view in the notification area from an IntentService, and getting the Couldn't expand RemoteView error. Here's what I am doing in onCreate(): mNotificationManager = (NotificationManager)…
Chaitanya
  • 2,039
  • 4
  • 25
  • 32
47
votes
8 answers

Failed to post notification on channel "null" Target Api is 26

Two log showing 1: Use of stream types is deprecated for operations other than volume control 2: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case
Mohit Singh
  • 1,402
  • 1
  • 10
  • 19
46
votes
6 answers

Why do we use the TaskStackBuilder?

Why do we use the TaskStackBuilder when creating a notification? I do not get the logic behind it. Can someone please explain. public void showText(final String text){ Intent intent = new Intent (this, MainActivity.class); TaskStackBuilder…
MisterNowhere
  • 605
  • 1
  • 6
  • 13
46
votes
5 answers

Is possible set Expanded Notification as default in Big Text Notifications?

I followed this Sample Code In Big Text Notifications section, he said that need expand to see Big text notification form, as image im below : I wonder that we can not set Expanded Notification as default in Big Text Notifications? People who know…
Huy Tower
  • 7,769
  • 16
  • 61
  • 86
45
votes
2 answers

Honeycomb notifications - How to set largeIcon to the right size?

I find myself curious why the setLargeIcon method on Notification.Builder only accepts a Bitmap, with no overload to provide a resource id. Perhaps it was done for performance reasons, but it seems odd as setSmallIcon does accept a res drawable…
Ollie C
  • 28,313
  • 34
  • 134
  • 217
45
votes
4 answers

How to update Notification with RemoteViews?

I'm creating a notification with RemoteViews from a custom Service, which is running with notification in a foreground mode (that is, service will remain active as long as notification is visible to user). Notification is set as Ongoing so user…
Siniša
  • 2,988
  • 4
  • 24
  • 36
44
votes
2 answers

How to Schedule Notification in Android

I'm trying to set notification for a time in the future. I have the code for creating a notification but I can't find an option to schedule it. How can I schedule notifications?
OmerN
  • 933
  • 2
  • 9
  • 20
44
votes
2 answers

Do GCM registration id's expire?

I know that C2DM registrations expire, and you are supposed to periodically refresh the registration ID. Is this the case with GCM? by looking at the following code on the Android GCM guide (shown below), it seems like you only do it once and don't…
Mohamed Hafez
  • 8,621
  • 7
  • 41
  • 49
42
votes
3 answers

How to set the app icon as the notification icon in the notification drawer

As shown in the figure... I am getting my notification icon(on left to the red colour). But I need to display the app icon as shown by the black arrow public void notify(View view){ notification.setSmallIcon(R.drawable.ic_stat_name); …
41
votes
4 answers

On Android 8.1 API 27 notification does not display

I get Toast on Android 8.1 API 27: Developer warning for package "my_package_name" Failed to post notification on ... Logcat includes next strings: Notification: Use of stream types is deprecated for operations other than volume control …