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.
Related
I am building a app with in-app subscriptions. I have implemented Real Time developer notifications as recommended by Google by properly configuring as mentioned over there. Whenever I purchase or cancel a subscription, SubscriptionNotification is published to the Pub/Sub topic as expected. But I am not able to get that message in the app. My requirement is that whenever message is published to the topic same message must be received inside app without any explicit request. And I have a pull subscription of Google's Pub/Sub api. So does pull suit here or should I go for push? So any kind of help would be highly appreciated.
You would not want to receive the Cloud Pub/Sub message in the application itself. In order to accomplish this, you would need to have a subscription per application instance and Cloud Pub/Sub is not designed to scale that way: the limit is 10,000 subscriptions per topic. Additionally, each instance of the application would receive all notifications for all users, which is likely not what you want.
The purpose of the real time developer notifications is for your service to receive notifications of changes to users' entitlements. Then, when users make requests to your service from the application, it can respond appropriately based on the subscription features that should be enabled. If you want an application instance to be notified when entitlements change, you'd have to implement that separately in the service in response to the Cloud Pub/Sub notifications. You could use something like Firebase Cloud Messaging to send the appropriate messages to individual application instances. However, you would still need to have a service that acts as a subscriber to Cloud Pub/Sub and gets the messages from the topic for developer notifications and then passes these along to Firebase Cloud Messaging.
I am making a project to track the school bus and want to sent the current bus location to parents' mobile device.
I am looking for a way to broadcast the location of one device to other devices in a pre-defined group.
Is it possible to communicate with all of the applications in the group without having to set up my own server/host/database?
it's possible to get location of another app device?
You can use push notifications for this.
It is possible to use Firebase Cloud Messaging (which is the new replacement for Google Cloud Messaging) to broadcast a message to several devices. You can see a complete walkthrough here. You'll probably be particularly interested in topic messaging. You could also do the same thing with Google Cloud Messaging, but keep in mind that that service is deprecated.
There are other push notification services as well (for example, through Amazon Web Services).
This kind of a solution generally doesn't require that you maintain your own server.
Please also see this answer for other options.
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 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'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.