2014-03-06 00:00:16 +01:00
|
|
|
package eu.siacs.conversations.services;
|
|
|
|
|
2014-09-19 17:21:33 +02:00
|
|
|
import eu.siacs.conversations.persistance.DatabaseBackend;
|
2014-03-06 00:00:16 +01:00
|
|
|
import android.content.BroadcastReceiver;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
2014-08-31 16:28:21 +02:00
|
|
|
|
2014-03-06 00:00:16 +01:00
|
|
|
public class EventReceiver extends BroadcastReceiver {
|
|
|
|
@Override
|
2014-03-06 03:30:03 +01:00
|
|
|
public void onReceive(Context context, Intent intent) {
|
|
|
|
Intent mIntentForService = new Intent(context,
|
|
|
|
XmppConnectionService.class);
|
2014-03-11 15:44:22 +01:00
|
|
|
if (intent.getAction() != null) {
|
|
|
|
mIntentForService.setAction(intent.getAction());
|
|
|
|
} else {
|
|
|
|
mIntentForService.setAction("other");
|
2014-03-06 03:30:03 +01:00
|
|
|
}
|
2014-09-28 15:21:56 +02:00
|
|
|
if (intent.getAction().equals("ui")
|
|
|
|
|| DatabaseBackend.getInstance(context).hasEnabledAccounts()) {
|
2014-09-19 17:21:33 +02:00
|
|
|
context.startService(mIntentForService);
|
|
|
|
}
|
2014-03-06 03:30:03 +01:00
|
|
|
}
|
|
|
|
|
2014-03-06 00:00:16 +01:00
|
|
|
}
|