I am developing a MVC Web App. The app will provide a platform for people to sell products and allow people to then search for an view these products.
I have no experience of what functionality Firebase FCM can provide. So my two questions are:
Can FCM be added to a MVC App to send push notifications to Android and IOS phones when a triggered by an event e.g a new product gets added to the web app
If it can be added to the Web App how customizable are the notifications e.g. can a notification be sent based on different type of events e.g. can different notifications be sent when different types of products are added to the web app?
Any advise would be helpful!
Yes... but it's up to you to write the code to do this. That is, you'd need to have some kind of process on your side (probably on a server) that's observing the data powering your web app, or your web app could do the work itself to "trigger" this process when it changes. (It really depends on how everything is structured.) This process could then submit a FCM notification that would go to all your mobile clients.
There is currently no way for this to happen automatically. That is, if you're hoping for some kind of "Hey, Firebase, send off a notification through FCM when you notice that a new child is added to your database" functionality, that's something that does not currently exist.
Since you'd be writing the code to create the notification, you can customize as much as you'd like. :)
Related
I am developing an Android application in Kotlin that can be thought of as similar to Instagram.
I am designing how to implement my in-app notifications. By "in-app notifications" I mean interactions such as likes, publication sharing, new chat message, etc.
For the moment, I do want foreground notifications. The notifications would not involve any view component.
The proposed flow would be:
Interaction action from Client_1 (like, share, message) triggers an Event_A in the server.
Event_A produces a state change and generates a notification to Client_2.
Client_2 receives the notification
a. Display a badge in the notification icon bar.
b. Generates a new item in the notifications list when Client_2 open it.
I make this clarification because, while searching this, I've seen "in-app notifications" are related to campaigns, publicity, new features, etc.
So far, I though two possible implementations but not sure if they are the right ones.
1 - Web Sockets
My app already uses Web Sockets for handling chat messages. However, so far, the connection is only open when the user enters to the chat view.
I consider easy to implement but this implies having an open connection the entire time the user is on the app and may be an unnecessary load for the server and an increment on Web Socket's time session.
2 - SNS + FCM
I've found that AWS SNS and FCM (Firebase Cloud Messaging) is a common approach for handling notifications.
However, reading the Firebase's documentation and examples, I understand it's mostly used for the other kind of in-apps notifications (campaigns, publicity, new features, etc).
In this FCM's documentation, it defines two types of messages: Notification Messages and Data Messages. I understand, Data Messages would be more appropiate for my use case.
Don't know it is worth the complexity of configuring FCM and handling the token's lifecycle.
So, my questions are:
Are the above scenarios good approaches? Is there any other way to achieve this?
Which is the correct term for this kind of notifications?
FCM is just normal push messaging. It can be used for any type of data. It's just a general method for a server to push data to an app, even if the app isn't running at the moment. So it's the right answer. The problem with web sockets is it won't work if your app is shut down either by the user or by the system.
I want to develop a website that will be able to send push notifications to a mobile application that would be able to run on both android and iOS.
For the last couple of years, I am working as a web developer so developing the website is not something that I am worried about, but I have never developed a mobile application before, the mobile app would only receive notifications from the website so the main functionality would be in the website.
Can anyone suggest me what the best approach is and what I have to learn to be able to do this?
Thank you in Regards
I guess, you have 2 options.
You can either use Firebase FCM
https://firebase.google.com/docs/cloud-messaging/
or use a third party which is called OneSignal
https://onesignal.com/.
If you are looking for an easier way then I recommend using OneSignal instead. You just need to define API Key in your build.gradle and initialize OneSignal in onCreate().
The best approach, in my opinion, would be to use firebase (https://firebase.google.com/products/cloud-messaging/). I think it is better because it is a unique framework for both ios and android and you don't need to worry about the user device when sending the message(you could build an interface in your backend code to handle this but why doing something that already exists and it is free).
The flow is something like this:
on the first start the app(either ios or android) must send its firebase ID to your server so that you can store it (simple http request will od it) and set up a listener for the incoming push messages
when you need to send a push message all you need to do is an http request and you can trigger it with js from your website. The request will contain data such as the firebase id of the receiving device(which you have previously stored)
Firebase Cloud Messaging also have some really nice features like upstream messages(push messages from the device to the server, but you need an xmpp server to listen for them) and topics to send the same notification to many users at the same time
I think the best approach would be to create a node server where the website would be running on and then use Firebase Cloud Messaging (FCM) to send notifications
EDIT: FCM supports both Android and iOS
I am new to gcm api for android and have for some time now i have being working on an android app to allow chatting between two users of the app. The app is such that a chat can only be initiated when one user opts to contact the other user. But my confusion comes in the manner i would be able to create a chatroom for these two users and for the other user to be able receive messages. since i found out that each user must subscribe to a topic inorder to receive messages in that topic. Would i have to subscribe all users to all possible topics or what? that is my big question but it seems it would have so much overhead considering i have 1000+ users.
Please i need all the help i can get here. Thanks
Would i have to subscribe all users to all possible topics or what?
GCM topic messaging allows your app server to send a message to multiple devices that have opted in to a particular topic.
It is not a requirement but it can ease the work for the server to send messages. In this tutorial, you will see that they have created a chat like environment using GCM without using the topic function.
BUT consider the effects on your server like how will it behave on the potential load when you use the topic messaging, especially the the message will trigger an interaction from the user to the server.
I want to send push notification in my app (Android) using Google Cloud Messaging. I am using firebase for backend. As firebase do not support inbuilt push notification i am using Google App Engine.
I do not have any idea on Google App Engine. Right now i am using a template provided by google for sending push notification.
Google Cloud Messaging Template Github
Till now i have deployed my app in Google App Engine and i am able to send push notification to all devices that are registered (From Web) An HTML page i get when i use GCM template.
What i want to do is , to Listen for Firebase data change and send push notification to user who is not online or has closed the app.
How can i run a servlet in background so that it keeps running in background and send push to user who is not online/connected.
As i have only push notification logic in Google App Engine Should i use servlet or struts.
Thanks in Advance
It is my understanding that Firebase really doesn't work very well with GAE, so you might want to reconsider your choices.
Listening for data changes, as you have mentioned, requires that your app leave a background thread running. To do this on GAE you have to disable automatic scaling which is an important feature of GAE.
You could create a separate backend GAE module with manual scaling and then have it use eg. a queue to notify your main GAE module of a data change, but this seems to me to be unnecessarily complicated and inefficient.
Hopefully Firebase will improve their product so it can notify of data changes in a more efficient and flexible manner, but in the mean-time, perhaps you should use a regular compute engine instance.
We are implementing a mobile app which let users share to-do lists. The idea is to have as little server administration as possible and obviously keep cost down.
For user management and push notifications we will use Parse.com with Cloud Code and PubNub for real time data delivery.
Every user will log in with it facebook' s credentials and subscribe to a read only private channel that only him can read. Every time he create a new to-do list to share with his facebook's friends, the app will make an API call to CloudCode, with it's identity, the data to share and a list of friends. In CloudCode the data is pushed to the PubNub private channels of the list of friends.
In addition in CloudCode the idea is to use PubNub Presence and if the user is offline, send a Push notification.
Is this implementation ok? I'm new to both services and trying to learn. Thanks!
PubNub is appropriate if you are trying to implement a realtime app such as a chat application or a GPS tracking application. But in your case, I think you may not need PubNub's features at all. You can have the afore mentioned functionalities using Parse.com only. The parse push can be used in both the scenarios.
When the user is logged in, and is using the application :- Receive the push, suppress the notification and update the UI with the newly received data.
When the user is not online or logged in, then simply create a notification and add a click listener activity for it.
The reason why I suggest to remove PubNub (for this particular application) is that, PunNub has a different pricing model for loading history. On the free plan, you are limited to one day of message history. On the other hand, you can run this app's backend on Parse.com, almost free cost.
There's nothing in the architecture you describe above that Parse can't handle, including the ability to support Facebook login and external service calls via Cloud Codes Parse.Cloud.httpRequest(). It will do it and do it well thus the answer is yes, this is ok.
Go forth and Parse.