I'm wondering, is it possible to make Facebook application send message via GCM service to my android app updates about new posts/messages/contacts etc? I'm almost sure that something like that is possible for Google+, and also I noticed that Facebooks API messages structure is very similar (or identical) to GCM messages. That is why i think it should be possible.
In other words: Is it possible to make Facebook application work as a server that stores devices IDs and sends messages on some changes via Google Cloud Messaging?
You'd have to drop in some kind of middleware to handle the interaction between the Facebook and Google API's -- with that being said, it's definitely possible.
Facebook's API offers the ability to subscribe to events (realtime). There's only a handful of events that you can subscribe to, and everything is outlined here and here.
Alternatively, you could long poll for data that's not revealed via their realtime API. Just think about API limites, etc. before hand.
Keep in mind that you'll need to create a Facebook application, and your users will have to authenticate the Facebook application so that you have information to whatever info you're trying to access. Sames goes for Google.
Related
Hello Everyone,
I have create gmail app and complete all types of functionality but one functionality not implemented this one is mail receive in our gmail app.
Me search any types solution for receive mail and i have found one solution is google cloud Pub/Sub but this pub/sub how to implemented in our app is not idea show please tell me any one how to used pub/sub in android.
Cloud Pub/Sub is not the right choice for receiving messages on Android. The service is designed for inter-service communication. Using it on Android would present two problems:
The limit on the number of topics and subscriptions per project. Only 10,000 topics and subscriptions are allowed and only 10,000 subscriptions per topic. If you plan to scale out to many devices, you will run up against these limits quickly.
Security/authentication issues. You would need to ship the credentials within the Android application and so you will either have to generate service accounts for every individual device or use the same one across all devices. What do you do if those credentials are compromised? In the former case, you have to keep track of all of them and revoke the right one. In the latter case, revoking the privileges means all of your devices stop working.
You need something like Firebase Cloud Messaging to send data to Android devices. You may use Cloud Pub/Sub as a means to generate notifications out of GMail, but the subscriber would be another server-side application or perhaps a Cloud Function that passes the notification on via Firebase Cloud Messaging.
Consider a whatsapp group. When any user texts in group, all the participants receive a notification.
Consider Youtube, whenever a content creator uploads a video, I get notifications.
These are all automated.
How to do this? I use Firebase as backend in my android app.
You need back-end services that you communicate with through an Api from your app. Think of this as a communication layer between Firebase and your app.
Generally this can be considered as a REST API. Here is more reading:
https://restfulapi.net/rest-api-design-tutorial-with-example/
I am new to android development,I am working on push notification app now and trying to get overview of concepts about GCM and got stuck with one of the concept about use of "endpoint".
I am going through below google developer link:
https://developers.google.com/eclipse/docs/endpoints-addgcm
they have given something like this
Google Cloud Messaging (GCM)allows your Cloud Endpoints to send
notifications to registered Android devices whenever the state of a
resource changes. For example, suppose a user uses a Note application
from 2 devices: Device A and Device B. If the user is adding a note
from Device A. Google Cloud Messaging can be used in the Cloud
Endpoint for the insert operation to ping Device B to indicate that a
note has been added.
my questions are
1>> Is GCM itself an endpoint?or it is a separate entity?
2>> how to interact with 3rd party app server without using endpoint for server and client?
Thanks in Advance!
GCM and Cloud Endpoints are separate and unrelated Google services (though one possible source of confusion is that the term 'endpoint' is often also used in more generic ways).
Endpoints is a service for creating public API's for GAE app's. It can make it easier to create the API's that will allow your clients to communicate with your GAE app, particularly if those clients are iOS, Android, or Web apps (the supported client types), and if you want to use OAuth2 authentication for the apps or their users.
GCM is for waking up, and pushing data to, your apps on those same platforms. It is true that your server app will probably use both GCM and Endpoints, they are separate and unrelated.
I am currently developing an app where users create posts that are stored on a server. When another user shows interest in a post by clicking a button, I want to notify the author of the post using push notifications. I have already set up the data storage using cloud endpoints with Google App Engine. Is there anyway I can use these endpoints to implement push notifications? If not is there another easy way to implement push notifications given my current setup? I have already read about Google Cloud Messaging on the developers page but was somewhat confused. I have kept track of the registration id's but I don't really know where to go from there. Thanks in advance.
You can use the HTTP interface to the GCM servers as described in this
Android developers page.
The easiest way to do it is by downloading the Google Cloud Messaging for Android Library using the Android SDK Manager, which will give you a jar that handles all the complexity of setting up the requests and responses to GCM.
Towards the bottom of that page, there is a sample Java application for push notifications on App Engine which you can use to get familiar with sending push notifications and then adapt to your needs.
I was just looking at the new Google Cloud Messaging (GCM) and I was wondering if it is possible to use GCM for Instant Messaging on your Android application?
I saw you can send data, like a message, from a server, but is it also possible to send from one device to another one?
And how would this work?
Some example code would be really helpful..
Tnx!
The official docs on Google Cloud Messaging for Android does mention that GCM can be used to develop an instant messaging app.
...or it could be a message containing up to 4kb of payload data (so
apps like instant messaging can consume the message directly).
So we went ahead and created an instant messaging app using GCM. The server-side is powered by Google App Engine. You can read the complete tutorial here. Create an Instant Messaging app using Google Cloud Messaging (GCM)
So it is possible to use GCM for Instant Messaging on Android, to answer your question. However, reliability of GCM compared to XMPP for IM is another topic.
Just my two cents:
I think you should not use GCM for delivering IM. You should have a dedicated server where your Android IM apps will connect to, using a persistent socket connection. Your server will know who is online or not and therefore can present an 'online list' to all the apps.
GCM can come into play, while users are offline or not running your app. A GCM message can be sent to them to indicate 'XXXX wants to chat'. They can then launch your app and automatically connects to a chat session.
Google has said that the delivery of GCM messages are not guaranteed. This reason alone is not a good idea to rely on them for Instant Messaging.
Try pub nub - it is pretty easy to implement - send Im from one mobile to another - simply fire up the web page (see link) in the browser , and chat between pc, mobile - and works - with 'no server'. Code is for javascript but they also have java. Chat app using jquerymobile web app framework
You might want to check out how a server sends a message to the GCM Service. It is possible to use php on Server side so it should be possible to adapt that to a POST request directly out of your application. However, to communicate you need the registered ids of the devices you want to send data to. Means you will need something to store and get them. Best solution would be your own (web) server which stores all ids and handles the Message sending.