简体   繁体   中英

Push Notifications To Android App (GCM)

Looking to integrate push notifications for the first time to an Android app.

I have done this for an iOS app using APNS, generally speaking I just want the notification to alert the user, I don't want to handle it within the app.

With iOS I can do this via broadcasting to APNS and the app isn't concerned with the notifications. Whereas from my reading on Android the app needs to register and listen for these updates within the app.

Is this correct?

From my reading on Android the app needs to register and listen for these updates within the app.

Is this correct?

Depends on your use case. If you want to have control over to which specific device(s) the push is sent, then yes, you must obtain the registration id in the app and store it on a server. This id is used by google to find the device to which the push has to be sent. You can then construct a message to push and use the registration ids to tell google where to push the message to.

However, with Firebase Console (Google Cloud Messaging is Firebase Cloud Messaging nowadays (same product, different name)) it is also possible to send push notifications to a certain target group you can specify. For example, you can use the Firebase Console send a push notification to all users that have made in app purchases in your app. The Firebase Console is a web interface where you manage your Firebase app/users/functionality etc.

Note that sending push notifications directly from the Firebase Console comes with certain restrictions/limits regarding message customization that sending it yourself would not have.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM