1

I've thinking this for a while that how do android app really notify its users?

Like Messenger, Messenger usually notify a user by making a floating circular profile picture of the sender.

and like other games like Subway Surfers or Zombie Catchers,

in the case of subway Surfers and other apps it notify users, when they are updated or an event is going on,

but in the case of Zombie Catchers, it notifies the users when their slushies are ready to be sold. Or the drones found new zombies at the alloted time.

So my concern is that, how can i notify my users when they have a unread messages or there is an event coming? without using Firebase?

  • It depends on the use case wether to use local notification or push notification. Messenger and Subway surfers use case uses push notification meaning they push message from server to android device. Zombie catchers probably uses local notification, i guess they have scheduled it for their use case. If you don't to want to use firebase you can set up your own push server like MQTT. Just do a research on it. – Sivakumar S Dec 27 '17 at 06:04
  • @SivakumarS Thanks for the advice, i will research it. – Christian Makilan Dec 27 '17 at 06:11
  • Check this [link](http://www.androhub.com/android-floating-widget-like-facebook-messenger-chat-head/). – Surender Kumar Dec 27 '17 at 08:26

1 Answers1

0

If you are not using Firebase then I guess you must be using SQLite in android. If you are using SQLite then in order to notify its users you must add a TRIGGER on the table so that whenever some value is inserted or updated you can create a Notification Builder or any sort of notification like a TOAST.

E.g: A user wants to know unread messages, there would be a table consisting of the number of message that are not opened. Whenever the app is opened it checks whether there are any unread messages and if there are/is, you can notify the user.

Link on how to use Trigger in SQLite. How to use TRIGGER in Android SQLite

Link to notification builder. https://developer.android.com/reference/android/app/Notification.Builder.html

However if you want the notification to appear when your App is closed, then you must also add a Sticky Service in the manifest file which would check the database after some interval and you should be good.

But I would recommend using Firebase since it has Value event listener and child event listeners making your task much easier.

Hamza
  • 81
  • 6
  • That's what i have done n my app, except that my database is an online MySql. and i have triggered the notification when a value is inserted only. and i got no idea what is sticky services, i only know what services are, but not sticky services, could you describe vaguely what sticky services are? Thanks in advance – Christian Makilan Dec 27 '17 at 07:12
  • There are two types of Services in android STICKY and NON STICKY. When invoked, the sticky service always runs in the background even when your app is closed unlike non sticky. More help on Services in android. https://developer.android.com/guide/components/services.html – Hamza Dec 27 '17 at 17:05