Questions tagged [push-notification]

Push notifications are alerts, badges, or sounds which are pushed to a mobile device from a remote server. Apple delivers push notifications via the Apple Push Notification Service (APNS). Android devices receive push notifications via the Google Cloud Messaging (GCM) service. In the past, Android devices used the Cloud to Device Messaging (C2DM) framework. Windows Phone apps receive push notifications either via MPNS or the newer WNS.

Push notifications are alerts, badges, sounds and/or data which are pushed to a mobile device from a remote server.

  • In , push notifications are delivered via Apple's Apple Push Notification Service (), triggered by a message from developers' servers to Apple's APN servers, which in turn push the message to iOS devices. Apple first released push notifications in iOS 3.0. Push notifications should not be confused with local notifications, which are a way for an app to post a notification to a device locally, with no interaction with push notification servers. New in , you can add flags to push notifications to make them silent or to trigger a background fetch.

  • In , push notifications are delivered via Firebase Cloud Messaging (). (Previously called Google Cloud Messaging ()). This replaces Google's Android Cloud to Device Messaging Framework ().

  • Push Notifications for Windows Store apps are delivered via the Windows Push Notification Service (), which enables third-party developers to send toast, tile, badge, and raw updates from their own cloud service.

  • Push Notifications for Amazon devices running (Kindle tablets, Fire TV and Fire TV Stick) are delivered via the Amazon Device Messaging () service.

References:

17860 questions
128
votes
13 answers

iOS push notification: how to detect if the user tapped on notification when the app is in background?

There are a lot of stackoverflow threads regarding this topic, but I still didn't find a good solution. If the app is not in the background, I can check launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey] in…
Bao Lei
  • 3,195
  • 3
  • 17
  • 15
124
votes
11 answers

Registering for Push Notifications in Xcode 8/Swift 3.0?

I'm trying to get my app working in Xcode 8.0, and am running into an error. I know this code worked fine in previous versions of swift, but I'm assuming the code for this is changed in the new version. Here's the code I'm trying to run: let…
108
votes
5 answers

How do iOS Push Notifications work?

How do iOS "push" notifications get delivered to a particular device without that device needing to poll a server? For example, let's say I have received a new message on Facebook. Facebook notifies Apple that my device should receive a notification…
Andy Hin
  • 25,283
  • 37
  • 95
  • 135
97
votes
4 answers

Android: Test Push Notification online (Google Cloud Messaging)

Update: GCM is deprecated, use FCM I am implementing Google Cloud Messaging in my application. Server code is not ready yet and in my environment due to some firewall restrictions I can not deploy a test sever for push notification. What I am…
91
votes
2 answers

What to use now that FirebaseInstanceId.getInstance().getToken() is deprecated

I would like to know what would be the correct way to get Firebase token for sending push notification now that getToken() is deprecated.
90
votes
15 answers

Get device token for push notification

I am working on push notifications. I wrote the following code for fetching a device token. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization…
88
votes
11 answers

Silent Push Notification in iOS 7 does not work

In the WWDC 2013's "What's New with Multitasking" presentation, there is a section about Silent Push Notifications. It seems straight forward. According to the presentation, if you send the APS payload with just the content-available set to 1,…
mkwon
  • 1,463
  • 1
  • 11
  • 15
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…
84
votes
8 answers

UIApplication.registerForRemoteNotifications() must be called from main thread only

Xcode 9 (iOS 11) showing me an error/warning while registering for Push (remote) notification. Here is error message And here is code, I've tried: let center = UNUserNotificationCenter.current() center.delegate =…
Krunal
  • 68,602
  • 40
  • 230
  • 241
78
votes
3 answers

Handling registration ID changes in Google Cloud Messaging on Android

In the docs on Google Cloud Messaging, it states: The Android application should store this ID for later use (for instance, to check on onCreate() if it is already registered). Note that Google may periodically refresh the registration ID, so…
AndroidDev
  • 20,063
  • 26
  • 131
  • 216
77
votes
11 answers

Why do I get "MismatchSenderId" from GCM server side?

I'm trying to create a push service for my Android app, and I follow Google GCM's documentation and example for this matter: I can register/unregister my Android app. From my server side, I can see that I have one subscription registered, but when I…
Seyed Vahid Hashemi
  • 5,022
  • 9
  • 50
  • 86
75
votes
11 answers

Swift ios check if remote push notifications are enabled in ios9 and ios10

How can I check if the user has enabled remote notifications on ios 9 or ios 10? If the user has not allowed or clicked No I want to toggle a message asking if they want to enable notifications.
user2636197
  • 3,432
  • 6
  • 40
  • 64
75
votes
9 answers

Why push notifications is not working on testflight?

I have tested push notifications as a developer account and it worked, But when i tried to put it on TestFlight for the testers to test it, it didn't show a push notification but the data is correctly received, So is there a kind of certificate that…
Iman
  • 1,037
  • 2
  • 11
  • 19
74
votes
9 answers

Android Push Notification (GCM), is there any Daily Limit?

Is there any daily limit for number push notifications (GCM) can be sent to a particular android application user?
Sajith Amma
  • 1,049
  • 1
  • 9
  • 13
70
votes
7 answers

Generate int unique id as android notification id

When I send multiple push notifications, I need them to be all shown in the notification bar ordered by the time sent desc. I know I should use unique notification - I tried to generate random number but that did not solve my problem since I need…
Zenogrammer
  • 703
  • 1
  • 5
  • 4