You are currently viewing GCM Replacement with FCM and Push Notification Fixation

GCM Replacement with FCM and Push Notification Fixation

  • Post published:January 21, 2020

SYNOPSIS:

Team span: Currently Active
Implementation Duration: 1 month
Technology: Ruby on Rails, Sencha Touch, Node.js, GCM, FCM
Development Manager: Shahroon Ali Khan
Engineer: Rashed Mehmood

Prometheus Labor Communications (PLC) is a platform that includes web and hybrid mobile apps that empowers Locals/Unions and its Members to communicate with each other. Unions can enable different modules for their mobile apps like upcoming events, automated news feeds, custom forms, groups and many more.

PLC has many clients and each client has own hybrid(Android, iOS) mobile app. Members of union/local can register using mobile app keep them updated with news and upcoming events. Admin of union/local can send push notification to any individual or all members of regarding any update or news. GCM(Google Cloud Messaging) was integrated to handle push notification functionality in mobile apps.

Push notifications need to deliver to members on time for each update from admin.

  • Push notifications were missing on Android devices having version 9.0 or greater
  • GCM was not handling push notification on all mobile devices
  • The gem used on server end for sending push notification was not always initializing notifications

We debugged this issue more on both server and mobile apps end and found different issues as following:

  • Google removed support from GCM APIs and it has been superseded by FCM(Firebase Cloud Messaging)
  • GCM gem on server end was deprecated and replaced with FCM gem for handling push notifications
  •  Push Plugin we were using in sencha touch was not supported with FCM and need to replace with newer plugin
  • In order to install new plugins for mobile app we found there are some other dependencies that need to upgrade or remove like:
    • Node.js
    • Cordova CLI
    • Cordova Android
    • NPM(Node package manager)
    • Ant build process has been deprecated for new versions of cordova for building mobile apps

Solutions:

To fix the issue of push notifications and update required versions we applied following solutions:

  • Updated Node.js to latest stable version (Node.js 12.14.1)
  • Updated Cordova CLI, Cordova Android, Cordova iOS to stable versions
  • Removed Ant build process for hybrid mobile apps as it has been deprecated and replaced with gradle build process.
  • Added new cordova plugin for handling push notifications using FCM. Removed the existing functionality and updated it with newer one.  
  • Updated versions of required plugins to fix compatibility issues with newer cordova version.
  • Removed gem GCM from server and added new gem FCM for handling push notification on server end.
  • Build both Android and iOS apps successfully and push notifications are working fine now.

Note:

Always keep updating your cordova and plugins to latest available version in case of hybrid mobile app development.

Conclusion:

Now we are building new mobile apps successfully using latest version of cordova. Push notifications are working fine now with FCM. We are also updating our existing apps to fix the issue.