-
Notifications
You must be signed in to change notification settings - Fork 1.9k
iOS Notification via GCM #115
Comments
Hi, I'm interested in this feature too, I'm not that a good iOS developer, so I probably won't be of any help coding for it... |
+1 |
+1 |
1 similar comment
+1 |
+1 so there is no way to use gcm to send notifications to ios for now? |
How??? Clearly the plugin README.md says: Supported Platforms
I think this plugin should be work for all platforms mentioned above, isn't? if not please add that asap! +1 |
The plugin does work with those platforms. This issue is a request to have iOS specific notifications work with the Google Cloud Messaging which was released recently. You can still push to iOS using the regular services provided by Apple (APNS)...Some of us just prefer to work with Google API's rather than Apple provided API. |
indeed. send push using google infrastructure is about ten times easier and straightforward than the apple counterpart (which requires a boring certificate in order to allow my server send messages). |
Is there an ETA for this enhancement? |
@bruno-serfe Yes, the plugin works for Android, iOS and Windows Universal. @sombriks using GCM for iOS is not a silver bullet as you will still need to setup the certificate stuff with Apple as IIRC GCM will just fwd to APNS. |
@macdonst My thought (unverified) was that the CGM servers are already "verified" with the APNS so by using GCM you can forego the requirement for a certificate on your server (as you don't communicate directly with APNS). I don't recall any setup in the GCM iOS tutorial (but maybe it assumes something?). Am I completely off? @sombriks I am using node-gcm for sending push notifications to android. It is quite painless to use as you can see from their example (https://github.com/ToothlessGear/node-gcm/blob/master/examples/notification.js). I have not used the other - as I am too lazy to setup the Apple developer account and the required certificates. |
@macdonst No, you need a certificate to make the push from the server. With GCM you can get the deviceToken to make the push notification but you also need the certificate to:
Hope that information help someone too. Regards, |
@bruno-serfe Never said you didn't need those things. @sombriks +1 to node-gcm and node-apns |
@macdonst I know, just I was added that information in order if anyone need to use GCM, know that the certificate is required, I only clarified your thought ;) |
Friends My experience so far: Android I already can work smoothly, After setting up the project in the apple developer to receive notifications. Then it must download the certificate (p12) and upload After uploading the certificate developer and production, it will bind a new key to the SenderID already created (created when used android). After that it will generate a downloadable file called google-service-info.plist. With this file you add it into the xcode project "The file contains configuration details, such as keys and identifiers, for the services you just enabled. After downloading this file, move it to the Supporting Files directory in your Xcode project." Well, then I ran my application, and got the key generated and tried to make a post to gcm sending my key ios and key cases. I now have a Invalid Registration problem. I believe I'm close. My question is if I have to modify the code Objetive c somewhere. |
Hi @deluxeuo this plugin not work with iOS and GCM yet, I've received the same "invalidRegistration" message and to resolve that, you need to use apple apn service in order to send the notification. If you're using PHP, you can take a look at this: http://libcapn.org/php-apn/ Remember that you need:
you can convert p12 cert to .pem using the following: Hope that helps Best regards, |
Bruno .. this is a problem in with PushPlugin? I was looking for some shipping APNs notification using java. You know something? |
@deluxeuo No, that is a feature not implemented yet as I understand. |
I have a fork of 1.3 release of this that I am working to add optional GCM support to ios It's still rough and only partial tested - will continue to fix and take feedback before doing a merge request. I hope to complete the first pass of coding/testing this week. The main issues are if I am packaging up the google apis decently - they do not offer a framework version. Cocoapods only which is a pain as far as I can tell for cordova. In any case they ideas is if you add an optional senderID to the ios options it will use GCM. |
@jtbdevelopment that's awesome, I look forward to the pull request. Yes, the lack of cocoapod support for Cordova is a pain but were working on it. |
OK - I was able to prove it out - using GCM I published to an ipad app some simple messages. If others want to give it a whirl - go ahead and try my fork out (remember it's branch gcm) and see the updated doc on specifying senderID and sandbox flag. Before I bother with a pull request if you can take look at this diff: As I mentioned, the changes to PushPlugin weren't overly extensive, it's including all the headers/libs from google that's the pain. This winds up dumping a lot of stuff in your plugin. I'm an experienced developer, but have limited Objective-C (wrote 1 fairly complex app a few years ago) and Cordova (working on my first app), so I'm open to better ways of doing things. Additionally, I opted to keep the entire google pack in there even though I know I could prune at least a few libs (Address Book stuff at least) as I thought it might be easier to include it all for the next time there is a GCM lib upgrade and the next guy doesn't have to hunt and peck to see what's needed. Open to trying to prune it down too. |
+1 for this. Hopefully it will be merged soon... |
+1! |
+1 |
unfortunately, I've not had the issue except as noted when I was registering a bad id. I again went through the process of running in debug mode on an ipad2, breakpointing registration, handler and message handler - everything registers fine. I then sent a gcm content message via curl to gcm and the ipad received it EDIT 10pm EST: I'll ask dumb question that sender id is defined as string in ios options structure? |
One thing may be how quickly you are registering - my own app has a fair bit of facebook/server handshaking that happens before push is registered so cordova and google should be good and primed. For reference this is the app I built. I'm providing the facebook link which has the app store/google play links. Unfortunately, the version that has working notifications is in apple review as I stupidly forget to go set up my prod credentials the first time around. Hopefully less than a week. https://apps.facebook.com/twistedbattleship/?fb_source=bookmark&ref=bookmarks&count=0&fb_bmpos=_0 Here's the code that registers push Here's the full app (note it uses core libraries under my id) |
@jtbdevelopment nope, the problem was I can be an idiot. I forgot to upload my .p12 file to GCM. I'm successfully registered now but haven't been able to receive a push but that's probably something dumb I've done. |
you still need to define all the fields or somebody drops it (presumably apple) curl --header "Authorization: key=YOURGOOGLEACCESSKEYHERE" --header "Content-Type: application/json" https://android.googleapis.com/gcm/send -d"{"registration_ids":["YOURLONGLONGGCMREGISTRATIONTOKENHERE"], "collapse_key": "Turn", "content_available": true, "notification": { "title": "title", "body": "body", "badge": "1" }}" |
@jtbdevelopment Yup, that works. Doesn't seem like you can omit the "notification" part. I was sending raw "data" messages. I'm going to merge your PR in the 1.5.x branch. Thanks for the submission. |
Merged in 1.5.x branch. |
Is it possible to try this out with as a beta version in Phonegap Build? thanks in advance |
Merged into master. |
Hi guys, I've been using the 1.5.2 branch, and I still having issue with "Push Plugin register failed", I did successfully add the p12 both dev and prod key to GCM and I'm using the same GCM senderID both for android app and ios, is there any step maybe I accidentaly skipped? nb: I'm running on ios emulator
|
I think that if you log the details of the error then you'll see that it is due to push not being supported when emulating. |
using the 1.5.3 branch. facing similar issue with @kh411d but im using it on a ipad. var push = PushNotification.init({
android: {
"senderID": variables.gcmSenderID
},
ios: {
alert: "true",
badge: "true",
sound: "false",
senderID: variables.gcmSenderID,
gcmSandbox:"true"
},
windows: {}
}); Push Plugin register called
GCM Sender ID 1234567890
Push Plugin register failed
using GCM Notification
using GCM Sandbox is there any configuration needed to be done @ the Apple side? update: got it fixed by doing the certificate registration between APNS and GCM |
@kh411d have you found sol var push = PushNotification.init({
"ios": {"alert": "true", "badge": "true", "sound": "true"}
});
Any help appreciated Thanks |
Sorry i am stupid i forget to include passphrase in my server stream context. All working good thanks |
I have tested it according to @jtbdevelopment on GCM with Android it works fine. On iOS, the device gets registered to GCM, receives device token, I send the message, it says success, but the device never receives anything. I have uploaded all certs (dev, prod) to the dev console as well. What else could I debug? |
@barocsi exactly the same happening here. The first time I send notifications, GCM responds with a success response, but further than that it always responds with "NotRegistered". |
(edit you have to see if you are doing the follow) Logic works as follows
|
I have just switched to APNS. |
Hi, All I am failing to register device when the app launches 2016-10-17 03:09:07.119186 myapp[635:162318] Push Plugin register called Ionic Clouding Service configuration and the app configuration is done according to the guide What do you think about this issue? |
I would check the certificates on your server. Are you in dev/production? Make sure you use the right certificate and the right URL (sandbox or prod). From: Heart [mailto:[email protected]] Hi, All I am failing to register device when the app launches 2016-10-17 03:09:07.119186 myapp[635:162318] Push Plugin register called Ionic Clouding Service configuration and the app configuration is done according to the guide What do you think about this issue? — |
I'm having similar issue. Any idea how to debug this? 2016-11-22 16:09:21.323078 SFF[829:242540] Using APNS Notification Thanks in anticipation. |
We resorted to using APN and GCM to resolve the problem – we’ve not retried it recently with the newer GCM versions. Alastair From: Ifemide [email protected] I'm having similar issue. Any idea how to debug this? 2016-11-22 16:09:21.323078 SFF[829:242540] Using APNS Notification Thanks in anticipation. — This document is private and confidential. Newsquest Media Group Limited. Registered in England, number 01676637. Registered office: Loudwater Mill, Station Road, Loudwater, High Wycombe, Bucks HP10 9TY. |
This thread has been automatically locked. |
Recently, I found out that GCM support iOS messaging.
From what I recon, you register device with APNS and then submit the token to GCM and in "return" get a GCM token you can use for pushing notifications to iOS devices. If I understand correctly, GCM just pushes your payload to APNS (but I could be wrong here).
From the little I understand of both native iOS development and of Cordova/PG plugins, it seems like a relatively small change to the iOS code (the part of registering Apple token with GCM) could enable a simpler server notification code.
Does this make sense?
Could this indeed be added?
I've seen that the iOS example code (native) uses dependencies from google - is that something that can be used within the plugin code?
I don't have much experience with either iOS or plugin development but if the above is feasible, and someone can "assist" with it I'd be happy to contribute my time for this.
The text was updated successfully, but these errors were encountered: