Android messanger app: user online / offline status - android

I am searching for 5 days how to check and show users-list online/offline in my android messenger app.I am new in android and i need suggestions.
I need to check and show users on/offline status :

I did it the following, not that it is the only way.
I used push notification system. When a user comes online, it sends a notification to the server, server checks its friends so that it knows whom to notify, then send another push to the correspondence devices. On reciever, instead of pop up, I just changed the view or etc...
I did that long ago with GCM for a company. Firebase is the new GCM.
Not sure if it's the most helpful way but it works.
Firebase

Related

Can I set the "Difference push receive setting in firebase?"

I am now trying to make a mobile app push notification service on Firebase. But the function description is not quite specific as I expected.
I want to know these functions are available on Firebase. If not, It would be pleasure If you tell me other tool.
User can select the push message types they want to receive.(Ex. Receive sale information push, Do not receive game event push)
Instantly send auto push messages when user triggered certain condition.(Ex. Send appreciate push message when user closed their first app-open)
Thank you
Can not tell in much description here:
1. User can select the push message types they want to receive.(Ex.
Receive sale information push, Do not receive game event push)
You can use FCM's channeling feature,
You can set different channels.
Show the list of channels to user.
User can subscribe to the required channel.
User will receive the specific channel notification only.
Please refer : Notification Channel
2. Instantly send auto push messages when user triggered certain condition.(Ex. Send appreciate push message when user closed their first app-open)
You have manage this thing in your front end and backend logic.
Like on app close send request to the backend (can use onDestroy method )server and then the backend server will send notification.
Hope this will help you.
For Feature 1:
You can achieve this without even doing anything. Just send all notifications to everyone. However, use different Notification Channels. Users, can then choose to turn on/off certain notification channels using the Android system features (in relatively newer versions of android).
Another way could be to send these notifications to different FCM Topics. Give the users a settings pages, where there can select what kinds of notifications they would like to receive. In response to their selections, subscribe or unsubscribe them to the respective FCM Topic.
For Feature 2:
There could be several hundred ways of doing this. Can provide better advice if you could provide more information about your requirement.
If you talk about your example requirement
(Send appreciate push message when user closed their first app-open)
You can do it without any server, or push messaging scheme. Just keep track of the first_open event inside the app using Shared Preferences. Once you detect a first_open event, just compose a notification inside of the app locally, and show it whenever you like.

How to display messages in notification format like WhatsApp, when app is in background for chatting application on Android

I'm developing a chat application like WhatsApp. We are using our own API with our own database server for sending and receiving messages. It is working perfect.
Now, the receiver and the sender should get the notification alert whenever they receive messages from each other if their apps is not opened.
It became a big task to me to accomplish. I'm unable to get the notification alert. I tried to use Firebase, but still I don't understand, what are requirements I need to give (Tokens, Keys).
Please, let me know if I need to change any data in my server side and is there any possibility to integrate from my server to Firebase and if it is possible then what are the parameters I need to integrate/send.
maintain status of each user , like when app opens make them online and onDestroy() make update status to offline , if user is offline send both message and notification where as if user is online send only message....

Android User Specific Push Notifications

I need some advice on sending pus notifications to my android app built in android studio. I have done a lot of research on the subject but it seems that all the examples, tutorials etc sends one notification to multiple users (similar to a news app that sends a notification about a new article to all of its readers) using GCM, pushbots etc.
What I am trying to achieve is to send a specific account notification to a specific user (similar to a facebook push notification when someone writes on your wall or the bank sending a push notification when a transaction occurs on your account).
The backend data will be on SQL server and as data comes in to the server, notifications needs to be sent to the associated user.
I am not sure if the processing of this happens on the server and then just pushes the notification to the users android device or if there is a service running on the android device which runs in the background and periodically checks for changes in the data and then gives a notification when it detects a change in the data based on certain conditions (more like a pull notification if you will as the android device actually pulls from the server).
Any advice as to where I can start and do more research regarding this will be much appreciated.

calculating the number of user receving a push notification

In the startup I'm currently working, we have developed a push server that enables the user to receive push notification when new content uploaded in our database.
Our system currently stores how many push are send and through Google analytics we can see how many people interact with the push notification, yet we would like to know how many people in total receive the push notification.
How can we count how many devices recevie the push? Which method could we use? As an example users unistall the app but we still have them stored on our database, or users may opt-out from the push through system settings (both ios and android)
Thanks for the help!
You can achieve it using same analytics by which you are able to identify how many people interacted with push using analytics. you will have to call your analytics function for pushRecieved in broadCastReciever for your GCM implementation.

Push Notifications status check Android

User can disable push notifications in later versions of android for an application, is there any way application can know that push notifications are disabled by user in settings ?
Look here: http://developer.android.com/google/gcm/adv.html#unreg
There one way is explained.
Another way could be:
If you have implemented a GCM server then your app sends a message to the server that it does not want any updates anymore.
After that the server deletes the regId from its devices database.
From now on your device should not get any Push Messages.
You could also try to make a client side decision and filter the messages if the user does not want any push messages (that way they would still be sent on the server side)
So I would implement a server side solution. Seems to be the cleanest way for me.

Categories

Resources