Push Notifications And Game Invites (Not Working For Me)

Hey Guys,

I have been using the Corona Cloud API for a week now and till now everything was working like a charm for me.

However today I started running into problems when I tried to get user invites together with push notifications to work.

I am able to register devices for push notifications (using coronaCloud.registerDevice(system.getInfo(“deviceID”))

However when I try to send a push notification via the web interface, this message is returned to me:

_We’re sorry, but something went wrong._We’ve been notified about this issue and we’ll take a look at it shortly.

I have followed the tutorial and pasted my Android API key under Push notifications/settings…I am not really sure what goes wrong with this one.

About the user invite function, how is the invite made visible to the user you are sending the invite to?

I have tried to send an invite and than login to another account and just call acceptChallenge(withAppropriateGameID) however the user is not showing up in the game’s players.

I am looking forward to your help.

Thanks in advance!

What does your invite code look like?  How are you getting the playerID of the player to invite?

Is your client waiting to play getting a list of matches with getMatches()?  What is the content of the results/response to getMatchs() look like?

Hey Rob,

Thanks for the quick reply.

Awesome! I got it to work, I was using game_id instead of _id to identify the game…so I can now send invites and accept them.

The only thing that is not working right now is push notifications, have you maybe got an explanation for this error:

We’re sorry, but something went wrong.

We’ve been notified about this issue and we’ll take a look at it shortly.

Cheers

Hi qwertier, we are looking into this.

Thanks

-Mohamed

Hey,

I have been searching the net and the Corona website, but I am having a hard time finding out what the deviceToken needed to register a device for push notifications really is.

Is it just the device id => system.getInfo( “deviceID” ), or should I be using something else?

Thanks in advance

Make sure to read this blog post:

http://www.coronalabs.com/blog/2011/12/21/push-notifications-for-ios-in-corona-sdk/

Basically when your user installs  your app, you’re going to get an event dispatched which has the deviceToken in it.  That lets you know that your app and device have successfully registered with Apple’s servers.  You can now take this deviceToken (part of the event table for the event) and use it to register your device/app with the push notification service of your choice.   If you’ve set the cloud up correctly and all the certificates are correct, you can then call the registerDevice() API call to take care of business.

Hey Rob,

Could it be my version of Corona that keeps me from using Android push?

I am using the latest public release (2012.971)…

Cheers

What does your invite code look like?  How are you getting the playerID of the player to invite?

Is your client waiting to play getting a list of matches with getMatches()?  What is the content of the results/response to getMatchs() look like?

Hey Rob,

Thanks for the quick reply.

Awesome! I got it to work, I was using game_id instead of _id to identify the game…so I can now send invites and accept them.

The only thing that is not working right now is push notifications, have you maybe got an explanation for this error:

We’re sorry, but something went wrong.

We’ve been notified about this issue and we’ll take a look at it shortly.

Cheers

Hi qwertier, we are looking into this.

Thanks

-Mohamed

Hey,

I have been searching the net and the Corona website, but I am having a hard time finding out what the deviceToken needed to register a device for push notifications really is.

Is it just the device id => system.getInfo( “deviceID” ), or should I be using something else?

Thanks in advance

Make sure to read this blog post:

http://www.coronalabs.com/blog/2011/12/21/push-notifications-for-ios-in-corona-sdk/

Basically when your user installs  your app, you’re going to get an event dispatched which has the deviceToken in it.  That lets you know that your app and device have successfully registered with Apple’s servers.  You can now take this deviceToken (part of the event table for the event) and use it to register your device/app with the push notification service of your choice.   If you’ve set the cloud up correctly and all the certificates are correct, you can then call the registerDevice() API call to take care of business.

Hey Rob,

Could it be my version of Corona that keeps me from using Android push?

I am using the latest public release (2012.971)…

Cheers

We are also having problem sending Push Notifications through Corona Cloud !!

After logging in, getting the device ID and sending device registration request, we get the event that the device is registered the first run and then subsequently “already registered” so I take this as an indication that the APNS is OK with the PN registration?

When submitting notifications from Corona Labs dashboard, it says “Notification successfully sent.” but we don’t see any notifications on the device.

Trying to send notifications between the devices using Corona cloud doesn’t work either.

I’m under the impression that with the Cloud we don’t need a notification server (other than the cloud). Is this correct or am I out in the blue here?

Hi Joel,

Have you tried disabling misconfigured push setting in Corona Cloud Dashboard?

For me the problem was that I had both Apple and Android push enabled, but only Android was configured correctly. So after disabling Apple push everything worked fine.

Hope this helps!

Qwertier

Hi, thanks for the tip but it still doesn’t work (we are developing for IOS).

I’m almost sure it’s something wrong with the certificates or keys. We have followed these tutorials by the letter and still no go:

http://www.coronalabs.com/blog/2011/12/21/push-notifications-for-ios-in-corona-sdk/

http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12

When trying the sendpush.php script in the Corona tutorial above I get:

PHP Warning:  stream_socket_client(): Unable to set private key file … sendpush.php on line 21

I also get an Error if I’m trying to import the resulting ck.pem file into the Keychain (just as a test) which again leads me to suspect the cert / key files.

Again, everything seems correct on the device. It asks for permission to receive Push Notifications, I get the Device Token after registering, etc but still no notifications… I’m seriously running out of ideas.

Hi,

Would you be able to email me mohamed(at)coronalabs.com the certificates and passphrases for me to verify on my end?

Thanks

-Mohamed

@qwertier  Yes, Android push was added just before Christmas 2012 which is well after 971.  I don’t remember the build number where it went in, but if you look at the daily builds around the week of 12/20 you should see it.

Hi again guys, and thanks for your response.

We have started to get things working now. Sending from a php script now works! There was probably something wrong with the key or certificate files. I also found out that it is not necessary to make two separate .pem files and combining them. I just exported from Keychain Access (Version 7.0) as .p12 file and then used:

openssl pkcs12 -in exported.p12 -out ck.pem

For some reason I get verify error:num=20:unable to get local issuer certificate when verifying with openssl s_client but it doesn’t seem to be any problem. Maybe I miss some CA certificate or something.

BUT sending from Corona Labs panel is still not working. It says “Notification successfully sent” but no notification is received. I haven’t had time to try device-to-device via Cloud yet. Any help is much appreciated.

Hi Joel,

Can you please send me your game ID and device ID, and I can check it out on my end.

Thanks

-Mohamed