Sending notifications / notifications from the server to the Android application without Internet access

I need to send a push notification from webapp to an android app. Basically, I just want to tell the android client that new data is available on the server. So it should only be the line + vibration / sound of the phone.

The problem (big) is that I am inside a corporate network without access to the Internet. That is why I can not use GCM.

So far, I have found the following options for completing a task without GCM:

  • Use XMPP
  • Websockets
  • Ajax poll

Is it possible to incorporate WebSockets or AjaxPolling into a native Android app to trigger events like vibration?

Is there a simpler solution, not as much overhead as with xmpp, since I just need to send a short notice? So far, I understand that I need something like SMACK XMPP for Android +, for example. Openfire and server side XMPPHP for this scenario.

+4
source share
1 answer

Since no one answered, I want to offer you an approach that I am trying to pursue now.

Laravel API. Redis, → https://laravel.com/docs/5.1/events

:

Redis::publish('test', json_encode($data));

Socket.IO Server-Instance, .

var Redis = require('ioredis');
var redis = new Redis();

redis.subscribe('test');

....

server.listen(3000);

Socket.IO android, socket.io Android. : http://socket.io/blog/native-socket-io-and-android/

private Socket mSocket;
{
    try {
        mSocket = IO.socket("http://localhost:3000");
    } catch (URISyntaxException e) {}
}
+1

Source: https://habr.com/ru/post/1625501/


All Articles