I have set up the openfire server and want to send push notification on webapp, Andriod and ios by my java backend server.ie if I send push notification message by java server on openfire it should be able to send notification on connected apps.
Asked
Active
Viewed 636 times
0
-
I used a server and a plugin in this way: https://stackoverflow.com/a/51167471/5853262 – Mahdi Moqadasi Jul 17 '18 at 07:02
1 Answers
0
As far as I know, there is no plugin for Openfire that support Push notification like Firebase.
The solution for your problem could be the Background service. This service will be running in the background and receiving stanza for your application. Also downside of this solution would be battery life as your service is constantly running in background.
Your service could be started with app and also could be started with receivers like BootReceiver, NetworkReceiver, ShutdownReceiver etc.
public class MessageService extends Service { }
And in lets say NetworkReceiver start your service that process Stanza like Message or PResence packets:
public class NetworkReceiver extends BroadcastReceiver {
public static final String EXTRA_DATA_NAME_NETWORK_CONNECTED = "my.package.name.NetworkConnected";
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (ConnectivityManager.CONNECTIVITY_ACTION.equals(action)) {
Intent serviceIntent = new Intent(MessageService.ACTION_NETWORK_STATUS, null, context, MessageService.class);
serviceIntent.putExtra(EXTRA_DATA_NAME_NETWORK_CONNECTED, NetworkUtils.isNetworkConnected(context));
context.startService(serviceIntent);
}
}
}

Kenan Begić
- 1,228
- 11
- 21