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.
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.
I am trying to use Delphi (10.3.2) code to send push notifications to specific Android devices, but can't figure out how to do it properly.
The tutorials and guides I have looked at only provide help for receiving notifications (which works very nicely), but in all of them the notifications are sent directly via the Firebase console.
Is it possible to accomplish this directly in Delphi?
Sending messages to devices through Firebase Cloud Messaging requires that you call the FCM versioned API and specify the so-called FCM Server Key. As its name implies, this key should only be used on trusted environments, such as your development machine, a server you control, or Cloud Functions. The reasons for this is that anyone who has the FCM Server Key for your project can send notifications to all users of your app. So you'll not want to include this key and functionality directly in your application code.
The common approach is to set up a server-side endpoint (e.g. a self-defined API that you create on something like Cloud Functions or your existing server), and call that from your application code. The server-side code can then ensure that the user is authorized to send notifications to the folks that are targeted, and call the relevant FCM API to send the messages to the devices.
This FCM API for sending messages comes in a few flavors. I'd first consider if there's an Admin SDK for your platform, as that's the easiest way to make this work. If there is no Admin SDK, you can make HTTP calls to the v1 API directly.
I am building an Android app with a server at back end. What I want to do is, whenever anything new is updated in server the app should trigger a notification into the users phone showing the newly added content.
EDITED TO ADD: This is even more important as of Android M and beyond. As part of a comprehensive effort to improve battery life, the OS actively restricts many of the techniques that apps have used in the past for sync and notifications. Use built-in methods like JobScheduler and GCM in order to avoid issues.
The core notification mechanism in Android is Google Cloud Messaging (GCM), documented here. It's built in to the platform at a low level and directly supported by mobile networks, so it's usually the most efficient choice. It doesn't have a guaranteed latency, so it may not be appropriate for very time-sensitive messages, but it's generally quite fast--at least as fast as sending SMS, for instance.
There are a number of different commercial products as well as FOSS libraries that wrap GCM in various ways, for instance to provide support for very old (pre-Froyo) devices or devices without Google enabled, or to provide a single cross-platform solution between various competing mobile platforms. Firebase, Parse, and Urban Airship are some that I'm aware of.
To use GCM, you need to get an API key from Google. You use this API key to authenticate requests to the GCM server. Once you have a key, sending a notification is as easy as sending a POST request to the GCM server. GCM also supports XMPP, but I haven't used it.
On the client side, your app needs to call the GCM API to register for messages. You provide the project name that you used to create the API key, so that GCM knows which server messages should go to your client app. Once your app has registered, incoming messages will be sent to it as intents, which you can receive by implementing a BroadcastReceiver.
There's a tutorial on the Android developer site that walks you through the GCM process.
I have an Android application that uses C2DM. I am creating another application derived from it. Currently, Google don't support C2DM, they moved to GCM.
But I want to use the C2DM for the derived app still. Is it possible to add multiple packages that can be notified via C2DM in the manifest?
You're confused. A single server can notify multiple apps, the C2DM/GCM rules don't prohibit that.
The apps would have different package IDs, but the notification generating code on the server does not need to know them. All the server needs to know is a registration ID. Which the app obtains, and somehow transmits to the server.
The app needs to provide an API Key (GCM) or Google account (C2DM) at registration time to subscribe to notifications. But not vice versa, the server does not need to authenticate against packages.
If the notification protocol varies from one app to another, you need to communicate the supported protocol along with the reg ID to the server.
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.