Questions tagged [notifications]

A notification is a user interface element displayed to indicate an event has occurred.

A notification is a user interface element displayed to indicate an event has occurred.

Notifications typically occur in a designated area of an application's UI, such as an icon appearing in a status bar or an alert message.

15068 questions
123
votes
5 answers

Remove notification after clicking

I want that the notification will be closed after the user is clicking on it. I saw that everybody saying to use flags, but I can't find the flags anywhere because I'm using NotificationCompat.Builder class and not Notification class. Someone have…
Yossi Zloof
  • 1,539
  • 3
  • 12
  • 13
123
votes
11 answers

Open application after clicking on Notification

I have a notification in my app with the following code: //Notification Start notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); int icon = R.drawable.n1; CharSequence tickerText = "Call…
Reza_Rg
  • 3,166
  • 7
  • 28
  • 47
123
votes
7 answers

Uri to default sound notification?

I use the Notification.Builder to build a notification. Now I want to use the default sound notification with: builder.setSound(Uri sound) But where is the Uri to the default notification?
StefMa
  • 3,216
  • 4
  • 21
  • 46
117
votes
11 answers

How to play a notification sound on websites?

When a certain event occurs, I want my website to play a short notification sound to the user. The sound should not auto-start (instantly) when the website is opened. Instead, it should be played on demand via JavaScript (when that certain event…
Timo Ernst
  • 13,291
  • 19
  • 95
  • 153
115
votes
5 answers

Ask for User Permission to Receive UILocalNotifications in iOS 8

I have set up local notifications in the App Delegate Using this: - (void)applicationDidEnterBackground:(UIApplication *)application { UILocalNotification *notification = [[UILocalNotification alloc]init]; [notification setAlertBody:@"Watch…
dannysandler
  • 1,851
  • 4
  • 13
  • 14
107
votes
18 answers

How to display multiple notifications in android

I am receiving only one notification and if there comes another notification, it replaces the previous one and here is my code private static void generateNotification(Context context, String message, String key) { int icon =…
Kartheek s
  • 3,737
  • 6
  • 28
  • 58
105
votes
15 answers

How to clear a notification in Android

Is it possible to clear a notification programatically? I tried it with the NotificationManager but its not working. Is there any other way I can do it?
rahul
  • 1,079
  • 2
  • 8
  • 4
105
votes
5 answers

Sending a notification from a service in Android

I have a service running, and would like to send a notification. Too bad, the notification object requires a Context, like an Activity, and not a Service. Do you know any way to by pass that ? I tried to create an Activity for each notification but…
e-satis
  • 515,820
  • 103
  • 283
  • 322
102
votes
15 answers

Best way to serialize an NSData into a hexadeximal string

I am looking for a nice-cocoa way to serialize an NSData object into a hexadecimal string. The idea is to serialize the deviceToken used for notification before sending it to my server. I have the following implementation, but I am thinking there…
sarfata
  • 4,425
  • 4
  • 25
  • 33
101
votes
11 answers

How exactly to use Notification.Builder

I found that I am using a deprecated method for noficitations (notification.setLatestEventInfo()) It says to use Notification.Builder. How do I use it? When I try to create a new instance, it tells me: Notification.Builder cannot be resolved to a…
Saariko
  • 1,615
  • 4
  • 25
  • 45
93
votes
15 answers

Get notification when NSOperationQueue finishes all tasks

NSOperationQueue has waitUntilAllOperationsAreFinished, but I don't want to wait synchronously for it. I just want to hide progress indicator in UI when queue finishes. What's the best way to accomplish this? I can't send notifications from my…
Kornel
  • 91,239
  • 30
  • 200
  • 278
91
votes
13 answers

PendingIntent works correctly for the first notification but incorrectly for the rest

protected void displayNotification(String response) { Intent intent = new Intent(context, testActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, Intent.FLAG_ACTIVITY_NEW_TASK); Notification…
user350617
90
votes
8 answers

How to add button to notifications in android?

My app plays music and when users open notifications screen by swiping from the top of the screen ( or generally from the bottom right of the screen on tablets ), I want to present them a button to stop the currently playing music and start it again…
frankish
  • 6,347
  • 5
  • 43
  • 93
87
votes
5 answers

How to get focus to a Chrome tab which created desktop notification?

I would like to implement same functionality as Gmail has nowadays. When new email arrives or new chat comes, notification popup appears and if you click it, the tab with Gmail gets focussed. I have this code: var n =…
Frodik
  • 13,164
  • 22
  • 83
  • 132
87
votes
9 answers

No notification sound when sending notification from firebase in android

I am sending push notification from firebase to my Android Application. but when my app is in background firebase onMessageReceived method is not called instead firebase send notification to system for showing notification in system…