Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Push Notification Problem - SenderID now missing in the new version

Author
Message
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 13th Aug 2018 23:26
I did write this in the version update thread but thought it'll have more chance of being seen in it's own thread

I've updated the notifications for Android using the code in the new guide but I'm getting this error:

{"multicast_id":XXXXXXXXXXXXXXXX,"success":0,"failure":1,"canonical_ids":0,"results": [{"error":"MismatchSenderId"}]}

I'm going to assume that the MismatchSenderID is showing because we're no longer providing the sender ID with SetPushNotificationKeys("XXXXXXX", "")

Does anyone know where the Sender ID goes now?

This guide doesn't mention it:
https://www.appgamekit.com/documentation/guides/push_notifications_android.htm

And this page says SetPushNotificationKeys() no longer works:
https://www.appgamekit.com/documentation/Reference/Extras/SetPushNotificationKeys.htm

I get a token generated, and I'm saving it in my database table so everything seems to be correct on my side, with the exception of the now missing SenderID.
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 14th Aug 2018 00:09
I was doing this testing with the AppGameKit player on my Android

I can see the SenderID in the google-services.json file so perhaps push notifications now only work if you export an APK with that json file packaged with it. I'll try this tomorrow night after work.

I'm sure I've tested push notifications in an older version of AppGameKit and the player.
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 14th Aug 2018 20:55
Installing the app as an APK with the google-services.json file sorts out the token problem now and doesn't give that sender id mismatch error, but when the app is closed or minimised and I send a notification to the device an alert pops up on the device saying:

"MyApp has stopped

Open app again"

This happens everytime a notification is sent to the device for my app.

Anyone else experiencing this? I'm using the latest version of AGK.
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 14th Aug 2018 23:32
Here's an odd thing, odder than me talking to myself...

If I uninstall the newly compiled APK and download the app from the store again (one that was compiled with an older version of AGK) the notifications using the new PHP code/setup go through but they come through blank. It has the App name and icon on it but the message is blank. I can understand and accept that because the $fields array has changed from:

$fields = array('registration_ids' => array($deviceToken), 'data' => array("message" => $message, "title" => $title),);

to:

$fields = array("to" => $deviceToken, "notification" => array("body" => $message),);

But this finding just tells me that there seems to be a bug with the latest version of AppGameKit because it doesn't even send a blank notification, instead it just crashes the app.

@Paul can you or someone in TGC confirm please?
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 23rd Aug 2018 13:27
Can you send me a bug report from the device shortly after the crash occurs?
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 26th Aug 2018 09:40
Hi Paul, I've just sent the bug report, screenshot and an email to the AppGameKit support email address.

Thanks,
Kevin
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 29th Aug 2018 11:19
Unfortunately it hasn't made its way to me, please send it directly to me at paul@thegamecreators.com
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 8th Sep 2018 15:08
I'm bumping this one again as GetPushNotificationToken() isn't returning a token in the latest version via a compiled Android APK file.

It does return a token in the AppGameKit Player.

@Paul, as it's not crashing/erroring can you still get what you need from a bug report?
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 8th Sep 2018 17:46 Edited at: 8th Sep 2018 17:49
If it helps I've noticed this is only seems a problem when the APK is installed as a new one, and not installed over an existing one. If it's installed over an existing version of the app that was previously downloaded from the Play Store then it retrieves the token with GetPushNotification(). I've not put the new version on the Play Store to see if it works for new users that haven't installed an old version of the app.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 10th Sep 2018 15:52
The log might still reveal something. I know it sounds obvious, but have you ticked the Push Notification permission in the export dialog? It could also be an issue with the Firebase config file not matching up with the given package name, or not liking the debug keystore, but I can't be sure.
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 10th Sep 2018 17:04 Edited at: 10th Sep 2018 17:05
Yep the notification checkbox was ticked and I did re-export a new config json file from the firebase site but it was identical to the last one. I think I mentioned above I didn't create a new version on firebase as there's a version of the app out there using the current settings and I couldn't create another version with the same name. The guid on the help pages don't mention removing the old firebase project and creating a new one.

Notifications work in the new version but only seem to work (for me anyway) if I update/overwrite an old APK on the device, one that was compiled with the May version of AGK. One before the notifications were changed.

If I remove the old version completely and install the latest compiled version they don't work. No token is generated.

I'll get you the log within the next day or so.

Login to post a reply

Server time is: 2024-11-23 14:49:48
Your offset time is: 2024-11-23 14:49:48