A few days ago, our business team want to introduce a new feature to our application. The feature is whenever a user gives a Guest Pass(an internal service) to another user, a text message will be sent to that user if the application isn’t installed in the receiving user’s phone. To achieve this feature, we need to build an uninstallation tracker in our backend system. In this blog, I’ll try to demonstrate how I build an uninstallation tracker.
Real-time uninstallation tracking system is a good approach here. However, there is a limitation which is it’ll not support the iOS platform. Our application is a cross-platform app. Both android and iOS users are in the market who are actively using our application. That’s why I have to choose no other approach but to use silent push notifications.
Again, there are many options that provide this service including Firebase, AWS and so on. Here, I choose FCM (Firebase Cloud Messaging) notification powered by Google because after going through the entire structure once again, I found that the FCM notification service is already running for sending push notifications in our backend system. I just need to set some configurations to build a silent push notification system. Hence I choose FCM for sending silent push notifications.
Now, the implementation of FCM began here. But I don’t know anything about FCM let alone implement the entire functionality. Therefore, I googled for it and thoroughly read some blogs on it. Also, I observed the codes in our backend files implementing push notifications (pretty much similar configuration with silent push notifications) which were previously written. Moreover, I discussed with the flutter and iOS developer about how can we achieve that.
Here is how I built the uninstallation tracking system. First of all, every six hours, a silent push notification will be sent to the registered devices using the FCM token from our Node.js server. The FCM token is previously stored when the user installed and logged in to our application. For sending silent notifications periodically, I used the cron job, a Linux command used for scheduling tasks to be executed sometime in the future. If the process of sending silent notifications failed, it simply means the user already uninstalled the application from his/her device. After that, the value for the uninstallStatus
field will be true
as like {uninstallStatus: true}
in that particular user’s document in the user collection in our database. If the process of sending silent notifications succeeds, it means the user didn’t uninstall the app. Now, every six hours we can find that which user has uninstalled our application.
Coming back to our main feature, in this situation whenever one user sends a Guest Pass(mentioned at the top of this blog) to another user, a specific text to his/her device or a notification to the device will be sent based on the uninstallation status. Eventually, our developer team satisfied the requirement of the business team.
To build such a system, it took 2-3 days. I learnt to understand and rewrite previously written code. Additionally, my skills in googling and finding the right content among endless content have increased dramatically for sure.
If you want to learn more about how exactly I set up the configuration and file, please show your interest in the comment section below. Considering your response, I’ll write a separate blog on it in a more detailed-oriented way.
Top comments (0)