ignore startService failure

some nokia devices with Android 9 fail to start the service from the activity sometimes. since this is probably a race it should be save to ignore this
This commit is contained in:
Daniel Gultsch 2019-01-09 18:30:25 +01:00
parent 25856992d1
commit 459db1a0a3
1 changed files with 5 additions and 1 deletions

View File

@ -217,7 +217,11 @@ public abstract class XmppActivity extends ActionBarActivity {
public void connectToBackend() { public void connectToBackend() {
Intent intent = new Intent(this, XmppConnectionService.class); Intent intent = new Intent(this, XmppConnectionService.class);
intent.setAction("ui"); intent.setAction("ui");
try {
startService(intent); startService(intent);
} catch (IllegalStateException e) {
Log.w(Config.LOGTAG,"unable to start service from "+getClass().getSimpleName());
}
bindService(intent, mConnection, Context.BIND_AUTO_CREATE); bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
} }