• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Android Push notification extension requires significant update

Appsurd

Member
A few months ago, I (finally) moved to GameMaker Studio 2. Converting all apps (Android and iOS) was relatively easy, so that's great! Many minor things have changed in GMS2, including push notifications: previously, the GCM (Google Cloud Messaging) was used, and now FCM (Firebase Cloud Messaging) is required.

However, more things have changed. The Push Notifications have been removed from the Google Play Services extension and have received its own extension. The implementation of the push notifications is still more or less the same as before, and this went fine. However, there are a few things which are not working properly.

The Asynchronous Push Event is not triggered at the start of the game for the registry of the token. As described in the manual, I created a persistent object which I placed in the very first room of the game. But when I receive a notification while the app is not opened, and I open the app from the normal screen (instead of clicking on the notification) the app opens but the notification is not removed. Besides that, since the asynchronous Push Event is not triggered anymore, data cannot be retrieved from the notification which has been sent.

In the new extension, it is possible to change the badge number by using the function push_set_application_badge_number. However, this function fails to work. The function always returns -1. Hence the user must always remove notifications manually.

Another issue is the grouping of notifications. I have some experience with Java, so recently, I wrote (for GMS1.4) some fixes to group notifications (see https://forum.yoyogames.com/index.php?threads/google-play-services-fixes.60947/) with API 27+. From Android 7 and above, notifications are grouped automatically while there are 4 or more notifications. It would however be great to automatically group notifications. However, the new extension does not allow for this approach, it simply ignnores the changes.

Now the question is: do you guys have similar problems with push notifications, especially:
  • Not being able to read data from the Asynchronous Push Event
  • Notifications must be closed manually (we want automatically of course)
  • Notifications are not grouped when there are 2 or 3

PS: I know YoYo has been updating the extension for GMS2.2.4. However, the changes they applied do not apply to nor solve either of the points above.

PPS: After some users confirmed these problems, I am willing to submit a bug report, but I want to be sure that the problems are not accidental.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Please file a bug report - preferably one for each bug, but altogether if not - as the extension is actually going to be updated to fix a couple of other bugs that I've found recently too. Hopefully if you file this now, then it can all be updated at once.
 

Rushad

Member
Thanks, I will do so tomorrow

EDIT: done
Hey,

I also had some problems with firebase remote push notification :
1. Not being able to read data from the Asynchronous Push Event
2. When the app is in background and I get a push notification, then when I open it always shows the notification data as Null, instead of showing the stored data.

I dont know how to fix problem 2 but I figured out how to fix problem 1.

- In your file explorer open GooglePushNotificationExtention > AndroidSource > Java > GoogleFirebaseNotificationsMessagingService.java
- Find the block of code under the comment
// Trigger our notification
- Replace that block with this code
Code:
        // Trigger our notification
        JSONObject dataJSON = new JSONObject(extraData);
     
        GooglePushNotificationsManager notificationsManager = GooglePushNotificationsManager.getInstance();
        if(notificationsManager != null)
        {
            notificationsManager.showPushNotification(remoteMessage.getNotification().getTitle(),
                                                      remoteMessage.getNotification().getBody(),
                                                      dataJSON.toString(),
                                                      GooglePushNotificationsManager.PUSH_EVENT_REMOTE);
        }
 
Top