In Android, sending notifications to android phones via code in Firebase - android

I am developing an application that saves some data in the Firebase Database. As soon as the data is saved, I want it to be given as a notification to all the users connected to the application through code.
I couldn't understand the procedure to do so. Can anyone explain me how one can send push notifications via code in the chain as Android phone -> Firebase Database -> Notification to Android Phone with the data.

it isn't Possible to solve your Problem with Firebase only. You have to create a MySQL Server and work with PHP. Maybe this Video from Filip Vujovic could help you.
https://www.youtube.com/watch?v=LiKCEa5_Cs8

You can use GCM,it's simple.The GCM service handles all aspects of queueing of messages and delivery to client applications running on target devices, and it is completely free.

Related

Push Notification from local server

I am building my first Android app and need to know how I could use push notification.
My project is a home alarm system and also I have built my own local web server. Now I want to push a notification from my server to my Android app when an alarm appears in my server.
Currently my garage doors use the MyQ app and when the garage door opens or closes I get a notification on my phone, I want to implement the same thing in my app.
I've been reading about the Google Firebase Cloud Messaging but it seems exceeding my need.
If you need push notification on your cell phone then you definitely need to integrate your app with Google Firebase. (or at least that's the right way of doing it).
Alternatively, there is something called as local notifications & background process in Android you could do long polling to check if the garage door is open (probably every 2 mins or something). However, I don't recommend that as it can drain your mobile battery.
Also I recommend using Flutter as oppose to using Native Android. As there are some pre-built libraries for android and Google Firebase integration.
Take a look at this Youtube video - https://www.youtube.com/watch?v=2TSm2YGBT1s
Ouh, maybe thats a little bit too much for starting with android - nevertheless I want to help you.
You need a communication protocol between your server and your phone (i.e. Firebase as you mentioned or Websockets).
If your server sends a message to you client (your phone) you have to create a notification. (Android Developer Guide). That's the theoretical part. You will also stumble across a lot of
challenges with
asynchronous programming.
Firebase might actually be the simplest option. You could build your own web socket service too, but that would probably be more than you need. See this previous question for more options: Android push notification without firebase
Android has some services that communicate with firebase to receive notifications.
You'll need to implement a service on top of your web server (using backend languages such as Python, Node.js, PHP,...) so it can send notifications when an event happened (like the door closed) witch isn't a simple way for a beginner.
then your web server sends a message to firebase and tells it to send a notification to my client.
so I highly recommend using firebase because of the simplicity of usage. otherwise, you should implement a separate service on your android phone to get the notification (if you want to run it locally) also as explained do the backend side.

Realtime Web to Mobile Chat Application Using Firebase

We are building a real-time mobile to web text & image chat application using Firebase. Consumers can send messages to 10 categories for example, TV Help, Computer Help, Camera Help etc from an android mobile app. Agents will receive messages on an AngularJS web app where they can reply. Now, one category can have many agents under it.
For example, if ConsumerA sends a message to "Camera Help", the messages should be routed to AgentA & AgentB, if they are handling "Camera Help". Any of them can reply to the consumer.
What is the best way to structure a firebase database for this use case?
Also, we would like to send consumers android push notifications if the app is not in use. I have heard you can use a firebase queue, but it seems challenging, are there any examples of this?
Thanks
Well if I am to design your firebase it would be like,
Customer_name
Customer_number
Customer_address...and other customer related data
Category_of_item
Message
Time and date of message
The part of using firebase for push notifications is concerned, then there is no direct support for that in firebase I would suggest you to go for parse or GCM. Cheers :)

Sync contact android and ios?

i am trying to develop an application to sync contact's from device to server
i am aware of GOOGLE CLOUD MESSAGING, but what i exactly needed is to have my own server for contact's and if i manually added a contact in my server it should be update on device without any interaction by user on device.
The same process in ios and other platformed device's also.
similar to this : sync Contacts between iPhone(also Android) and server
The core of my question is : how to update any changes made in server on device side automatically thank you
Try looking into the SyncAdapter and trigger the updates via a push notification using GCM. The general structure would be:
A change is made in the contacts on the server side
The server sends push notifications to the devices that need to update the information
The SyncAdapter requests the updated data from your server
For IOS you can use APNS just like GCM for Android.

which database to use for android app

how can I deploy android application to receive notifications when the online database is changed?
Using a database phpmysql, how can I communicate this with my android app? Thank you all for the safe response
Try to have a look at Google Cloud Messaging, your server can push a notification to a specific device or broadcast messages to all your devices that something has happened on your server.

android, automatic push update data for apps

I want to push new data to the apps on user's device after a couple of days, like news update service. It's NOT APK update. Where do I get some clues to start with? tks in advance
(sorry if this question is dumb, but why can't I search for it on stackoverflow, I must miss something?).
You can accomplish this in many different ways. One option is to design your app to periodically query a server-side REST API and download new information in an JSON/XML format. That information can be stored in a local SQLite or flat file database on the device. You could also integrate with Google's Cloud Messaging service to send push notifications to the device. When your application receives a push message it could spawn a new background process to download any updated content from your server.
You can use push notification (search for c2dm) which will notify users whenever, content/data is updated on server. Whenever, android application will receive push message from server, it will update the local database (say, news database in your case) from server.
Hope it is helpful information for you.
Just upload the new app, with the same key that you used it previously and also increment the version code.

Categories

Resources