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
17
votes
1 answer

Android notification big picture dimensions

I'm trying to find the exact dimensions of the big picture style image on Android notification. Indeed, I need those in order to compute images on-the-fly at the right dimensions to avoid too big downloads in my application. I've made some tests…
ArchOrn
  • 171
  • 1
  • 3
17
votes
1 answer

Alternative for AudioManager.setRingerMode() in Android 5.0 (API 21)

I used AudioManager.setRingerMode() to handle the device volume in my application using: AudioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT) to turn off vibration and sound. AudioManager.setRingerMode(AudioManager.RINGER_MODE_VIBRATE) to…
Eldoth
  • 275
  • 2
  • 8
17
votes
3 answers

Adding a terminate playback button using Android L Notification.MediaStyle

I want to create a Media Playback notification using the new Android L MediaStyle template. Now, I succeeded doing so perfectly well for actions like previous, play, pause, next (by using addAction(), but I couldn't find a way to add a "close"…
17
votes
3 answers

GCM Push Notification Large Icon size

Hi Iam implementing Push Notifications in Android using GCM. I am trying to set an image for the notification instead of the default app icon. I am able to achieve this using the following code if(extras.getString("src") != null){ URL…
Ram G Athreya
  • 4,892
  • 6
  • 25
  • 57
17
votes
5 answers

Starting the app from Notification remove it from recent app history

I have a problem in one of my apps when I start it from a notification. It never appears in the "recent app" list. Without notifications, every thing works as expected: I start the app, navigate into and when I quit it (with home button or back…
ol_v_er
  • 27,094
  • 6
  • 48
  • 61
16
votes
2 answers

Start foreground service after notification permission was disabled causes crash (Android 13)

So, I've been experimenting with the new Android emulators (namely Android 13 or Android Tiramisu, API 33) and on an app, I need a foreground service. The app's target SDK is currently 33. Due to the notification requirement, I've added the…
16
votes
5 answers

In flutter how to clear notification in bar?

I am learning Google cloud messaging and firebase messaging is working fine, but when a user do not click at the notification to open the app and instead goes directly to app by manually opening it and bringing to foreground, the notification stays.…
puzzled
  • 509
  • 1
  • 5
  • 18
16
votes
4 answers

Correct way to create Notification Channels from Android O Api

The notification channels which introduced from Android O (API 26) version.I read about it from the following links: Managing notification channels Google Sample for Creating Channel Questions: If I have multiple numbers of notification then Is…
sam_k
  • 5,983
  • 14
  • 76
  • 110
16
votes
2 answers

Generic Listener when a notification is clicked or dismissed in Android

I want to know is there a way for the NotificationListenerService to know if a Notification has been clicked or it has been dismissed. I can see that the Inner class NotificationListenerWrapper in NotificationListenerService has a…
Aneez
  • 253
  • 2
  • 12
16
votes
2 answers

Firebase Cloud Messaging (FCM) - Launch Activity when user clicks the notification with extras

I'm trying to open a specific activity when the user clicks the notification, when the app is in the background, with some extra parameters. I'm using the click_action and it's working fine, the app opens the desired Activity. Now I need the server…
16
votes
2 answers

NotificationCompat and setFullScreenIntent()

I was wondering if anyone has some experience with with this type of Notification. In my use case I want to trigger a notification from my Service and than it should open a fullscreen video. The method setFullScreenIntent look just the right thing…
Aksiom
  • 1,565
  • 4
  • 25
  • 39
16
votes
5 answers

Show ongoing notifications in Android Wear

I've been playing around with Android Wear and making some dummy apps. What I've noticed is that Android Wear doesn't seem to show the notifications that are ongoing,i.e., notifications with setOngoing(true). Any way to show these notifications on…
d3m0li5h3r
  • 1,957
  • 17
  • 33
16
votes
2 answers

Multiple notifications and only show the first one in Android

I'm creating an app that has to show more than one notification. I was looking for information and I use this code in class: Notification noti = new NotificationCompat.Builder(this) I can show more than one notifications on the bar, but the problem…
Fernando
  • 349
  • 2
  • 6
  • 21
15
votes
3 answers

Android SQLite DB notifications

I am writing an Android app that needs to be notified whenever a given SQLite database changes (any new row added, deleted or updated). Is there any programmatic way to listen to these notifications ? Is writing DB triggers for each table the only…
Sriram
  • 1,174
  • 2
  • 9
  • 11
15
votes
3 answers

Does updating a Notification remove a Service's foreground status?

In my app, I place my Service in the foreground to prevent it from being killed by using: startForeground(NOTIFY_ID, notification); This also displays the notification to the user (which is great). The problem is that later I need to update the…
yydl
  • 24,284
  • 16
  • 65
  • 104