I have a cross platform application and i want to send notification to sign in users about their messages.
Now I confused about uses of push, local notifications.
What I think of Push notifications is that it is for sending Announcements to users which is not specifically related to their account only.
Can anyone help me out with what should I use? I already used Local notifications in one of my applications with such requirement.
It mainly depends on; is the data coming from local or remote?
You cannot control when your users open the app, and only when they open the app (with a few exceptions) you are able to fetch data. Then with that data you would be able to schedule a local notification. But in most cases that doesn't make much sense, because they have already loaded and probably seen the data. It only makes sense when you schedule an alarm clock for instance.
When you want the data to come from remote, like when they receive a message, you will have to use push notifications. The user is then alerted that new data is available without having to go look for it themselves. It is pushed to them.
However, for push notifications you will need infrastructure which you did not when using local notifications. You will need a server to handle the push notifications (Azure has some awesome functionalities for this) and some trigger to send push notifications. This can be an insert on a database, or a scheduled task. Also, the user has to enable push notifications and your app has to register itself to be able to receive them. It can be a pain to implement it the first time.
It depends on for what reason you're sending the notification.
A local notification is sent locally on the device, so it doesn't need an internet connection. Examples could be:
Send a birthday message when the user has birthday
In a harvesting game, send a local notification when the store is full
A Push Notification is sent from a server and it requires internet on your device to receive it. Examples:
You get a message in a chat while the app is not open (if I understand your question right, this is your case)
In a game: realtime events which are triggered by a server
So in your case, if guess you want to notify the user about new messages if he does not have the app opened. This notification comes from a server and is a Push Notification.
As you describe you want to send notification about sign in users about their messages. so it would be the real time notification about when there is message for user you need to notify the user. so apple having PushNotification is the best approach you need to apply for this. using that you can directly notify user about the new messages.
Why LocalNotification is not useful in this scenario?
I think messaging is the realtime stuff. local notification is not for that. its for only managing local notify stuff. like reminder OR to do added task.. and many more
Related
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.
I am creating mobile application using latest version of Ionic 3. And I am at the point where I need to implement push notifications. I am using FCM. I have managed to done it for Android phones using this plugin: https://github.com/phonegap/phonegap-plugin-push. Reading documentation for this plugin, it says that for Android I should send only Data Messages and that that is the best practice. It also says that send Notification and Data payload would not work properly:
When your app is in the foreground any on('notification') handlers you have registered will be called. If your app is in the background, the notification will show up in the system tray. Clicking on the notification in the system tray will start the app and your on('notification') handler will not be called as messages that have notification payloads will not cause the plugins onMessageReceived method to be called.
But for IOS I need to send notification message with data payload. This would not be a problem if I target directly devices, however I need to send Topic Messages. So the way I see is that on my server I need to implement this logic:
Let's say that the name of topic is FOOD-AND-DRINKS:
function onSomeEvent($data) {
// send push notification to topic ANDROID~FOOD-AND-DRIKS
// send push notification to topic IOS~FOOD-AND-DRINKS
}
Also, since in the future my plan will include multiple cities, and not all people would like to listen for notifications for cities other the one where that person lives, so then my topic would be PLATFORM~CITY~CATEGORY.
So my question would be, is there any better plugin for handling notifications, or some service between my server and Google FCM and that service would take care of that, or this is quite OK what I have proposed?
You can use cloud functions to be able to send notifications since you are using FCM also.
More on this here: https://firebase.google.com/docs/functions/
Cloud Functions for Firebase lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your code is stored in Google's cloud and runs in a managed environment. There's no need to manage and scale your own servers.
Using cloud functions you can use database triggers like onWrite() and it will be able to send notifications if you have data payload and/or notification.
But if you use data payload alone then you can send if android device is in background also.
Regarding Topics:
If you have multiple cities in your application, then you can let the user register to each topic. You can do in the database like this:
city-category
id_here
cityname: nameX
//other details
id_here1
cityname: nameY
//other details
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.
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.
Here I am developing an android app which deals with housing complex.
In this app their are 2 kinds of users:
Builder/Complex Owner
Flat Owner.
Now here the Builder/Complex Owner can send push notification to flat owners.
How can I achieve that? Please help.
Here I cannot use G.C.M as G.C.M. is used for server side push messaging.
Not sure if there is any other way. What you could do is to let the app send a push notification request to the server, then the server would issue the push notification through G.C.M. If you don't have a server available you could do it through text messages but be sure to have a good text messaging plan. You could possibly also use an existing service (for example Facebook) and send the messages through their API.
EDIT:
To do it via text messages: SMS receive with no notification. Again, make sure that you have a good text messaging plan if doing this. Sending an SMS to ten different people will count as ten different SMS messages.. If you have a lot of users it would probably be cheaper to get hold of an SMS server. But then again, you should just use G.C.M.
It is possible to send device to device push notification using gcm.See this link.