October 22, 2024
Chicago 12, Melborne City, USA
PHP

What Is the Best Practice for FCM Data Messages Backward Compatibility?


I’m building my first mobile app and I’m facing the following situation.

I have a Laravel API that sends data messages through FCM to an Expo mobile app. When the mobile app receives the data message, it takes the payload, builds a notification configuration, and uses Notifee to notify the user.

However, a question that comes to mind is: what will happen if I need to change the data message payload in the API? How can I ensure backward compatibility when I can’t be sure that all users have the latest version of the app, and notifications won’t be built correctly in the older versions of the app anymore?

Two solutions came to mind, but I’m not sure if there are better ones:

  • The mobile app expects certain payload properties in the data message, and if they are missing, it falls back to a default configuration (e.g., fallback title and body).
  • Keep both the old and new properties until the old app version is no longer in use. I believe I can see some usage statistics about specific app versions in the Apple App Store and Google Play Store.

How are you handling this in your projects, and what is normally considered the best practice?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video