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
14
votes
4 answers

Is there a way an app can check if it is allowed to access notifications?

I want to implement an NotificationListenerService to get access to all notifications that are posted to the notification bar. I understand that I need to enable access to the Notifications in the Settings with this call: startActivity(new…
Janusz
  • 187,060
  • 113
  • 301
  • 369
14
votes
3 answers

NavUtils.shouldUpRecreateTask fails on JellyBean

I have an application that issues notifications that when selected start an activity. According to the Android docs I can use NavUtils.shouldUpRecreateTask to check whether the activity has been started directly (i.e. from the notification) or via a…
Clyde
  • 7,389
  • 5
  • 31
  • 57
14
votes
2 answers

How to get android notifications when app was closed?

From webserivce I am getting data in the form of dates and time, means for some particular date i am having some set of slots. The following diagram gives the detailed explanation. Here on each date I have some set to timings. Here what i want is…
user1578518
14
votes
5 answers

How to create a notification without icon in the statusbar or simply hide it?

I'd like to know how to create a notification that doesn't show the icon in the statusbar. There is a way to hide it?
Meroelyth
  • 5,310
  • 9
  • 42
  • 52
13
votes
2 answers

Output: error: resource style/TextAppearance.Compat.Notification.Info (aka package_name:style/TextAppearance.Compat.Notification.Info) not found

After switching to Android Studio 3.2 canary I am getting the following build error. I have seen this post where the guy had a similar issue but no solution was mentioned over their. I want to try new material components and jetpack so is there any…
13
votes
4 answers

Hide notification from Foreground Service on click notification Action

I have an Alarm App that have foreground service with a Heads-Up Notification and that notification have two actions where one send an intent to the Service and can open an activity depending on the app configuration. The problem is that when i…
user3285324
  • 142
  • 1
  • 9
13
votes
5 answers

Cannot disable notification vibration in Android 8

I try to disable vibration when showing a notification. Func: public static Notification buildNotifForUploaderService(Context ctx, String title, String message) { Notification notification; NotificationCompat.Builder…
Adam Varhegyi
  • 11,307
  • 33
  • 124
  • 222
13
votes
3 answers

Android Auto notification not showing

I'm attempting to show a notification through Android Auto. The notification does show on my phone. However, it is not showing on Android Auto emulator. This is a media application. automotvie_app_desc.xml:
mattfred
  • 2,689
  • 1
  • 22
  • 38
13
votes
4 answers

How to make a screen wake up when a notification is received?

For my app I'm trying to get it where the notification wakes up the screen and displays a view from the app. I can't figure how to get the app to wake up when its in a lock screen. I've tried a few things but none seem to work or they crash the app.
13
votes
2 answers

Android 26 (O) Notification doesn't display Action Icon

With Android 26 (O) introducing Notification channels I have been investigating the Google supplied com.example.android.notificationchannels This example works as expected until I attempted to add an Action to the Secondary Notification defined…
Hector
  • 4,016
  • 21
  • 112
  • 211
13
votes
2 answers

android.app.RemoteServiceException: at android.app.ActivityThread$H.handleMessage when sending notifications

I use a service to display notifications. On some rare devices (3 users among 50 000 every day), I have the the following crash (which can be seen in the Google Play developer console ; only on Android 4.x devices)…
toto_tata
  • 14,526
  • 27
  • 108
  • 198
13
votes
6 answers

Android Push notification sound is played only when app is in foreground but not playing sound when app is in background

I am using FCM for push notification below code to play sound when notification received public void playNotificationSound() { try { Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); …
13
votes
8 answers

Large Icon Bitmap appears as white square in notification?

I am having this problem where I generate a Bitmap from a URL that I use in my notification. However, on my phone, the Bitmap shows up like a small white square. I looked into it and found many posts like so talking about it: Icon not displaying in…
user1871869
  • 3,317
  • 13
  • 56
  • 106
13
votes
2 answers

How to know whether Notifications are enabled or not for an application in android?

I've a ListView which has the list of installed applications and for each application, I need to know whether the notifications are enabled or not. Currently I'm using below code to know if the notifications are enabled: appOpsClass =…
Ashraf
  • 143
  • 1
  • 8
13
votes
2 answers

How to display countdown timer on status bar in android, like time display?

I am making an app which allows the user to pick a date and time. Once the date and time are reached,it will display an animation on the screen. Before its time, it will just show countdown time (like xxx:xx:xx) on screen. I achieved this using a…