Good day,
I really hope someone can help me with this.
I'm having difficulties trying to sync data between 2 devices. Google Cloud messaging seems like the thing I want to use, and I've played with the tutorial. However I had the following questions:
I'm broadcasting commands to all users.. How do I send messages to a specific user?
How do I send data back to the webserver?
Is this the correct way of syncing data between multiple devices using the same google account?
The data will really be a small amount, so I do not need a massive server to accomplish it, and the 4KB limit on GCM will be more than enough.
PS I'm using Android studio.
Thanks for the help
I'm broadcasting commands to all users.. How do I send messages to a specific user?
Each device has specific registration ID. You can specify a particular registration ID and ask Google to send the Push. See Server example for that.
How do I send data back to the webserver?
If you want to send the data from device to your 3rd party server, you can either send it via HTTP or you can use device-to-cloud feature of GCM Cloud Connection Server.
Is this the correct way of syncing data between multiple devices using the same Google account?
I think the way you are going, you can accomplish what you want. I'm not aware of better alternatives though. Also, How to sync data between different devices might help.
Related
I am new in mobile app sector and I think about applications which contains google maps, can be available for Android/iOS (i do not have any experience in Objective-C/Swift, Android), has notifications between devices.
For google maps I did some research and I know that I have to google account for using google maps API. I will be able to display devices on the map in real time. How to find device in some radius?
For notification I know that there is Firebase but I have not used it. I saw it have REST API.
For application I want to use Apache Cordova (I know there is PhoneGap too).
I have backend in Java. I thought about something like this:
Device <-- REST--> JAVA (server/DB) <-- REST--> (Firebase)/(Google Maps API)
Is it possible to send notification device <-> device in my configuration?
Does Firebase need his own DB for user/device etc?
I thought about when someone open the app will see available other devices on map and will be able to "tap" on one of them and send it a notification. Is it possible?
Maybe someone can give some tips/links/knowledge about how i can achieve this or how it supposed to be done.
Thanks
How to find device in some radius?
You tell the server with your backend your location, it responds with a list of devices that are "in some radius" (by executing some code that does whatever you define that to mean).
Is it possible to send notification device <-> device in my configuration?
This is never really possible (or done that way). Notifications always come from servers from Apple or Google. If you want to trigger a notification from device 1 to device 2, device 1 would tell the server about it, then the server would tell the push provider who then tells Apple or Google to send a notification to device 2. (Which of course means that device 1 has to be able to identify device 2 somehow, and that the backend has to know about both of these and have a push token for device 2 saved so that it can tell the push provider to send a push there.)
Does Firebase need his own DB for user/device etc?
Firebase is a platform that offers multiple services. One of those is to send push notifications, another is a database to store information about device or users. So no, it doesn't need "his own DB" but there will have to be a database about users or their devices to be able to send notifications.
I thought about when someone open the app will see available other devices on map and will be able to "tap" on one of them and send it a notification. Is it possible?
That is technically possible, although not in this direct way you described, but what I elaborated above.
I am trying to develop the Messenger App like Whatsapp using Firebase.
I'm already done the code for device to device notifications and now I am trying to send the notifications to specified group.
Please provide the example code for the Group Notifications.
There are a few ways to send messages to groups of users:
Send the message to a topic that all users subscribe to. This is the simplest scenario, since you don't need to keep a list of tokens. But you have less control over the actual people that receive the message, as anyone who knows a topic can subscribe to it.
Keep a list of device tokens for each group in your app server, and then send to each individual device in the group.
You can also use the previous version of the API to send to batches of up to 500 tokens at a time. This sort of multicast delivery is not yet possible in the new API.
For an example of this, see the documentation of Cloud Functions and the sample repo.
Send to a device group with the legacy API. I'd only recommend this approach if the devices are actually owned by one user, which is the case that device groups are meant for.
Try this link
Don't forget this line Authentication:
key=<Your_API_Key>
The word (key) is important
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 :)
I am developing an app in android in Eclipse IDE. The app modality requires that any user can challenge his/her friend to do a certain activity. Whenever a user does so, the friend will immediately get a notification in his/her phone. Even more, the user who challenged the friend, will also receive a notification when the friend accepts the challenge. Is there any particular way I can provide this functionality? I know how to generate notifications. But the server side interaction is quite confusing. Should I check the server database through the app at frequent intervals and check for such activities in database? I think the procedure will hamper the performance of the app. I would be very grateful if anyone can suggest a good way.
But the server side interaction is quite confusing.
As you're pointing out, it's the server part not the Android one what's confusing here. If you don't have any constraints on the server part, I'd recomend to use Socket.io http://socket.io/ They have a tutorial for connecting socket.io with Android: http://socket.io/blog/native-socket-io-and-android/
It seems that you don't really need an interaction between the differents users but only a way to notify them. I always used Google Cloud Messaging to do so. It enables you to receive push notifications. As you said, checking the server periodically is battery/data consuming and not the best way to do it.
This link might help to set up GCM : http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/.
I am a newbie in android. I have developed few applications, but all are plain and simple, just used the built in features of android.
I was asked about push notifications, in one of my interviews and I decided to have a look at what Push Notifications are. I understand the concept of Push Notifications(I think), but whenever I read the term "Server", it's freaking me out.
I understand all the client side coding, but I don't get how to implement the server side coding. I have seen some people use XMPP, MQTT, etc., What are those? Here is my scenario and what I want to know..
Scenario ::: Let's say I have a website, with a table (the values are retrieved from database), where I update a few columns every day. I want these updates to be reflected in my android application. So, as I have read, push notifications can tell the application that there are updates available. Good. I am fine till here..
When the application gets the notification, should my application, contact the website and get the latest information? or will the updated information sent through Push Notification? I guess, my application would be contacting the website and get the information. Now, how do I get the data from the website? Should I get the source of the page and do some kind of parsing or something?
I will be asking more questions, as the experts clear my questions...
Sorry, if my questions are too naive, but this is the only place that can help me...
Push Notifications means Google Cloud Messaging for Android (GCM) is a service that allows you to send data from your server to your users' Android-powered device.
You can refer to this documentation
Google Cloud Messaging for Android
GCM: Getting Started
And there is also Demo App Tutorial given
in your case you need to create HTTP web service for getting data from the server.so when you get notification about update on server side.you just need to call this web service and get the data you need to update