Server push without GCM on Android - android

I am currently writing an Android app, and I would like to send push notifications from my server to the phones where this App will be running. Due to security reasons, I would like to avoid any third party server like Google's servers that are used when using GCM (Google Cloud Messaging). How can I achieve that? Or do I need to use a workaround (e.g. polling or working with GCM and encrypting the messages)?
Thank you very much in advance for your help!

The easiest way to prevent Google from reading your messages is simply not sending any data to GCM. Use send-to-sync-messages for that. To improve performance use collapse_key.
On receipt of a send-to-sync-message fetch the new data from your webservice. I also used this approach in a recent project with high security requirements.

Related

Using RESTful api or firebase

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/

How to send data from API to Android

I'm developing a Transport Management System using Dingo API with Laravel and Retrofit for Mobile App. When the clerk approves the request, the notification should be send to who uses android app(Client),So i wanna send data from Server to App.What are the possible ways to do it ?
Updated
How to use brozot/laravel-firebase cloud messaging ? Can anyone give an example for that ?
We can use:
Use push notification system like.
This approach is supported by Google. But is delayed to inform like what you are doing is right. Work that is not suitable for real-time. And does not require you to have a server and a lot of code to write.
https://firebase.google.com/docs/cloud-messaging/android/client
Or
https://developers.google.com/cloud-messaging/ -> move to firebase upper link
Use signalR
This real-time but connections are not loose management.And a lot of coding.
https://github.com/ahmadaghazadeh/SignalRAndroid

Framework for implementing an instant messaging service / chat

I want to implement an instant messagign service analogously to whatsapp.
The messages are delivered, even thoug sender and receiver do not need to be online at the same time.
Is there a framework existing to do so (btw I use a linux server). Is the Google Clouse Service suitable for this? Thank you
Google Cloud Messaging (GCM) is a service that manages small messages to / from android. It does require users to be using google play.
What makes it so cool is they will manage the connections for you. They will queue stuff up for a period of up to four weeks, and after that will send a message telling you that its been more than weeks, and you will need to process a new request to obtain the original messages again.
Its a free service. There are some rate limits, but they seem pretty reasonable. i.e. You can't use it for sending frequent game moves, but its totally fine for normal text messages. As I understand it, GCM is only a server interface. You will have to roll your own XMPP server to store and manage messages. Note: there is a payload limit on GCM messages, I think its 4k or so... not big enough for images. You'd have to manage those via http, and send image names via GCM.
They will also broadcast messages to users (1000 at a time). Did I mention this is a free service?
Something like this link will get you started. The API keys thing and registration #'s is sorta confusing. Once you figure that out, it all works. You can test to your emulator via curl messages to the google server, etc..
Oh, and GCM also keeps track of all your user analytics as well..
You can try openfire. It has offline message and everything. Server can be hosted in linux as well.
There is Layer (Android and iOS support for the moment)
Hey Checkout this easy way to implement chat
Quickblox Api

GAE Chat server for Android clients

I am looking for an optimal solution to implement chat server for android clients on GAE.
At the moment I use C2DM to notify particular users about new messages and pull data from server after such notification. But sometimes C2DM servers delay notification message and it stops to be realtime.
I also had a look on XMPP and it seems that it is mandatory to have an external XMPP server like google talk, so it is not what I am looking for too.
Is there another way to implement chat on GAE? Any advices are warmly appriceted!
The Reason why you are experiencing Delay with C2DM is because it is not real time. Google actually says this: It isnt the most reliable way. It suggest having a third party server such as XMPP
You can implement chat on App Engine using the Channel API, but the only supported clients for that are browsers. If you're prepared to make your Android app browser-based, that would be a solution - otherwise, you will have to look into third-party services, like Urban Airship.

Android:How to send data from server to android with no request from the android?

How can I send data from a server to an Android device without the device polling for data?
This is called a server side 'push' and is commonly referred to as 'pushing'. This is a well known feature of the iPhone, however, it does not currently exist on the Android. Android Cloud 2 Device messaging has not yet been released to the general development community. you may want to check out projects such as MQTT and Deacon.
You might consider using Googles cloud to device messaging for a solution.
You'll have to sign up for an account and are only able to use AppEngine servers at the moment.
Your application has to use API level 8 (2.2) in order to be able to receive the cloud's pushes.
GCM (Google Cloud Messaging) is the easiest way, and while GCM provides the basic service of sending messages, there are companies out there that do help you get up and running.
You could take a look at companies like urban airship, xtify and mBlox (developer.mblox.com) to get started with this and have a few additional tools that help you structure the push notifications in a more structured way.
Good Luck with your development!

Categories

Resources