-
Notifications
You must be signed in to change notification settings - Fork 1
Implementing Push Notifications for Android Applications
Push notifications are a useful addition to a web application as they allow the user to keep track of important events and reminders. In the case of Shuttle Tracker, we want to use it to notify the user if a bus is on its way to their location (the closest stop to the user). There are many different methods of implementing these notifications to interface with the database.
Much like how Swift is used to create Apple applications, Google has its own equivalent language known as Kotlin which is used for Android apps. Kotlin is an object-oriented language that functions very similarly to Java and JavaScript, allowing the user to directly alter both front-end and back-end code when needed. Programming a simple push notification is a long and somewhat tedious process, requiring the creation of multiple different object types imported from different libraries to generate the icons and message the user should receive. The takeaway from this method is that it should be avoided unless the developer truly wants to understand how Kotlin works at a fundamental level.
Table shows the methods that are required to create a push notification using Kotlin
Firebase Cloud Messaging or FCM is another application that was developed by Google for the purpose of app development, however, unlike Kotlin, FCM requires no programming to use as it is used for its database utilities. Think of FCM as Google's version of Amazon's AWS Cloud Service. FCM is useful for three different parts of server programming: App Development, App Growth, and Mobile Advertising. For app development, it can be used for server hosting, cloud messaging, generating crash reports, user authentication, and testing. The app growth section encompasses user invite functions, web search advertising, remoting configs, notifications, and dynamic links. The final category is self-explanatory, so no further details need to be given on it.
FCM is useful to Shuttle Tracker because it allows us to easily get analytics information without a gigantic section of code. It is especially useful for its push notification, app performance monitoring, and crash report functions. The notifications can be used as described in the summary above, to notify users of buses in transit. The performance monitoring and crash report features would be purely for developer use to make sure everything is working as intended with the Android mobile app.
Unfortunately, since Swift is not a language that is supported by Google, the easiest method of setting FCM up is the manual implementation.
- Free for new developers
- Real-time db is available
- Contains many different services
- Uses NoSQL, which is harder for SQL devs to get used to
- Newer platform, so it still might contain bugs
There are two plans that are available to users. The first, known as the Spark plan, is a free plan to the developer until the amount of app users reaches a certain threshold, at which point the developer must upgrade to the Blaze plan, which varies in price depending on the requirements of the developer. The free plan limits the developer to a certain amount of memory use, messages sent, and other features used per day.
- https://developer.android.com/develop/ui/views/notifications/build-notification#kotlin
- https://www.geeksforgeeks.org/firebase-introduction/#
- https://www.geeksforgeeks.org/how-to-push-notification-in-android/
- https://firebase.google.com/pricing
- https://medium.com/atlas/getting-started-with-firebase-for-server-side-swift-93c11098702a
- https://developers.google.com/identity/protocols/oauth2/service-account