I am looking to write an app that receives pushed alerts from a server. I found a couple of methods to do this.
Each has its own limitations. SMS- no guarantee on arrival time. Poll may drain the battery.
Do you have a better suggestion please? Thanks very much.
Android Push Notifications For Android, the notifications by default appear on the lock screen, and when the phone is unlocked, are visible as small icons on the notification bar at the top of the screen.
Chrome, Firefox, Microsoft Edge, and Other Browser Notifications. Most browsers support the Web Push API standard. This API can be used on both desktop and mobile devices to allow notifications from websites and to receive those notifications even when a website is closed.
Navigate to Settings > Mobile Apps. Click the mobile app for which you'd like to send a push notification. For Device Token, enter the token you located above. For Message, enter a message to display in the push notification.
Google's official answer is the Android Cloud to Device Messaging Framework (deprecated) Google Cloud Messaging(deprecated) Firebase Cloud Messaging
It will work on Android >= 2.2 (on phones that have the Play Store).
(cross-posting from an answer I gave to a similar question - Does Android support near real time push notification? )
I recently started playing with MQTT http://mqtt.org for Android as a way of doing this sort of thing (i.e. push notification that is not SMS but data driven, almost immediate message delivery, not polling, etc.)
I have a blog post with background information on this in case it's helpful
http://dalelane.co.uk/blog/?p=938
(Note: MQTT is an IBM technology, and I should point out that I work for IBM.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With