iOS support for Google Cloud Messaging

2019-03-08 19:30发布

问题:

I saw in google's developer console that GCM allows to generate a API key for iOS. I searched in the web for any kind of documentation about how to implement Push Notifications throught GCM in an iOS App, but i didn't find answers.

Is It really possible to implement Push Notifications jet using GCM in iOS apps? documentation, examples or something to learn how to do this?

Thanks!

回答1:

YES

I tried it and it works great. Follow this https://developers.google.com/cloud-messaging/ios/start

This is how it works.

You create app entry at google console. Upload development and production certificated in creation wizard.(You have to upload both) and follow the steps in docs.

Logic works as follows

  1. We request device token from apns as usual.
  2. Then we send that token to gcm service with provided api.
  3. Then gcm sends back a another token.
  4. We send that token to app server.
  5. App server can send notifications using that token.

Cool Features.

GCM for iOS has some cool features as

  • Subscribe to notification based on a particular topic. Ignore others.

  • Send Notification to other devices within the app.

If you want to try google sample app. UPDATE: it's Google with a capital G now. Just

pod try Google

There you will get an example in ObjC , swift and even mac app that can send notification.

Update.

Google is moving to Firebase cloud messageing from GCM.



回答2:

Google has now introduced Google Cloud Platform for iOS. See their blog entry for more information. Google Cloud Messaging is supported now for both Android and iOS.



回答3:

Google has updated their online documentation. You still need a valid APNS certificate. After, your app can register with GCM using the iOS GCM API. Your notifications server should work without modification.



回答4:

the answer is yes, you can use Google Cloud Messaging API to communicate with iOS devices, but its quite a complex process. You can read the official documentation on https://cloud.google.com/resources/articles/ios-push-notifications

Regards



回答5:

As of Google I/O 2015, Google officially added iOS support for GCM. You can find more information here: https://developers.google.com/cloud-messaging/ios/start



回答6:

While some Google APIs work with iOS GCM is for Android only. The only way to send push notifications to iOS devices is through the Apple push notification system. Google would have to support this.

You can always us something like Urban Airship if you want to push to multiple platforms.



回答7:

The response is no for Google Cloud Messaging. However it's possible to send push notification to iOS devices using Google Cloud Platform with Google App Engine and Google Cloud Endpoints. (See this documentation)
But you will need inevitably to communicate with the Apple Push Notication Service. The task to do it is for sure more complex than using directly the Apple service.



回答8:

Wow, this is really bad. Actually you need to modify the client on iOS for this to work! In my company this is just not an option unfortunately, so back to Amazon SNS.

The idea here is that with Google's implementation you only need to communicate with the GCM, but in order to send a message to iOS, then your device will have had to sync with GCM first to pass tokens etc, hence the need for the iOS client library.

As a user of Google App Engine, I was really excited by this, but this is a real let down.