I am having a kafka producer which is running in Spring boot i would like to integrate to andriod mobile(xamarin) to push some notifications without using FCM because google is restricted in china. So,i have successfully configured the producer below are my questions i have.
writing the consumer in spring and provide as a REST Service, in this case, need to maintain kafka as a separate server so that the consumer can run Independently.
In Case of writing the consumer in the android side and after receiving from the topic we can convert to an notification? is that possible?
Kafka doesn't send push notifications, so you'll need GCM (or whatever alternative works in your location).
Kafka clients pull information from the brokers, and doing so over a mobile connection is not recommended, so therefore having Kafka wouldn't really be useful in that scenario of the REST server, as it would only be a backend-only service.
Related
I'm new to Android and want some advice please.
I need to build two Android applications.
Android application for train travelers
Purpose: Sending a custom message (for assistence) to the railway guard. The railway guard will be identified on the basis of the wagon number that has been sent.
Android application for train guards.
Guard must be able to login and be able to receive (realtime) messages from travelers.
In short, this should be a one-way messaging system.
I'm used to build RESTful web application with databases. I have no idea which technologies i should use in this situation. As far i know i can't use databases such as MySQL, Oracle on Android. I've read that Firebase is an alternative for this but i'm not sure if it's the ideal solution for this kind of application.
I could build a RESTful server and make calls from the application. I guess if i do so the messages won't be received as realtime push notifications.
Any advice please?
RESTful services are hosted on a server and cater to incoming requests with a response.
Remote notifications are handled by a remote server. Under this
scenario, the client application needs to be registered on the server
with a unique key (e.g., a UUID). The server then fires the message
against the unique key to deliver the message to the client
application via an agreed client/server protocol such as HTTP or XMPP
and the client displays the message received. When the push
notification arrives, it can transmit short notifications and
messages, set badges on application icons or play alert sounds to
attract user's attention.[21] Push notifications are usually used by
applications to bring information to users' attention.
Source of above text
You can understand the basics and implement it into your application.
However, it is too much work and you really won't be gaining much.
It is much better to use Firebase and the documentation is quite good.
You need to pay as you go based on how much you are using Firebase.
A place to start:
https://firebase.google.com/docs/cloud-messaging/
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.
Currently, I have an Android app and a Web Service written in C# using Visual Studio. Web service is published to an IIS. Android app makes calls to the web service to retrieve data from a MS SQL Server DB.
Furthermore, I have a Windows Service that responds to certain changes in the data of MS SQL Server DB. Currently, the Windows Service is capable to firing off an email when data in certain tables in MS SQL server DB is updated.
What I am interested in achieving now is to use Google Cloud Messaging to implement notifications in the Android app. So for example, I would like for the Windows Service to be able to fire off a message to GCM Connection Servers and therefore talk to the Android app.
As you can see all of my back-end is Microsoft technologies. I was wondering if anybody has experience connecting the different stacks that I am using. Or if not, if anybody has a solid workable idea as how I can achieve what I want o achieve with the least amount of change in the technologies I am using?
Specifically, Android documentation talks about 3rd-party application server, that I would like to replace with with my Windows Service. But I don't know how. Any insight from prior experience or at least suggestion of a solid path to achieve my goal is very much appreciated.
If you need just push notifications to android devices then it's enough:
- android application has to be able to pass the device RegistrationID (for example, through your Web Service).
- your service has to be able to send POST requests to https://android.googleapis.com/gcm/send in order to send the messages.
If you need some CCS features then you should implement 3rd-party application server using one of XMPP libraries for .net. It is also possible with Windows Service.
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.
What is the best way for 2 android clients to communicate over gae? Sometimes my server app(on GAE) has to send push notifications to clients. I have tried Channel API on javascript clients. C2DM services seems not be a good solution at this moment.
Does any have some suggestions for me?
I think this is currently not possible with GAE. The Channel API is only for used in Browsers.
But you could use a 3rd party pushing service for that (have a look at http://pusher.com/ or http://www.pubnub.com/) and combine this services with the GAE services (like the Datastore or Task Queue).