remove deprecated instanceIdService
This commit is contained in:
parent
a15c50a15f
commit
25856992d1
|
@ -562,7 +562,7 @@ public class XmppConnectionService extends Service {
|
||||||
final String action = intent == null ? null : intent.getAction();
|
final String action = intent == null ? null : intent.getAction();
|
||||||
final boolean needsForegroundService = intent != null && intent.getBooleanExtra(EventReceiver.EXTRA_NEEDS_FOREGROUND_SERVICE, false);
|
final boolean needsForegroundService = intent != null && intent.getBooleanExtra(EventReceiver.EXTRA_NEEDS_FOREGROUND_SERVICE, false);
|
||||||
if (needsForegroundService) {
|
if (needsForegroundService) {
|
||||||
Log.d(Config.LOGTAG,"toggle forced foreground service after receiving event");
|
Log.d(Config.LOGTAG,"toggle forced foreground service after receiving event (action="+action+")");
|
||||||
toggleForegroundService(true);
|
toggleForegroundService(true);
|
||||||
}
|
}
|
||||||
String pushedAccountHash = null;
|
String pushedAccountHash = null;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest
|
<manifest xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="eu.siacs.conversations"
|
package="eu.siacs.conversations"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<application>
|
<application tools:ignore="GoogleAppIndexingWarning">
|
||||||
|
|
||||||
<meta-data android:name="firebase_analytics_collection_deactivated" android:value="true" />
|
<meta-data android:name="firebase_analytics_collection_deactivated" android:value="true" />
|
||||||
<meta-data android:name="google_analytics_adid_collection_enabled" android:value="false" />
|
<meta-data android:name="google_analytics_adid_collection_enabled" android:value="false" />
|
||||||
|
@ -23,11 +23,5 @@
|
||||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service android:name=".services.InstanceIdService">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
|
|
||||||
</intent-filter>
|
|
||||||
</service>
|
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
package eu.siacs.conversations.services;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.support.v4.content.ContextCompat;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.google.firebase.iid.FirebaseInstanceIdService;
|
|
||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
|
||||||
import eu.siacs.conversations.utils.Compatibility;
|
|
||||||
|
|
||||||
public class InstanceIdService extends FirebaseInstanceIdService {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTokenRefresh() {
|
|
||||||
final Intent intent = new Intent(this, XmppConnectionService.class);
|
|
||||||
intent.setAction(XmppConnectionService.ACTION_FCM_TOKEN_REFRESH);
|
|
||||||
try {
|
|
||||||
if (Compatibility.runsAndTargetsTwentySix(this)) {
|
|
||||||
intent.putExtra(EventReceiver.EXTRA_NEEDS_FOREGROUND_SERVICE, true);
|
|
||||||
ContextCompat.startForegroundService(this, intent);
|
|
||||||
} else {
|
|
||||||
startService(intent);
|
|
||||||
}
|
|
||||||
} catch (IllegalStateException e) {
|
|
||||||
Log.e(Config.LOGTAG,"InstanceIdService is not allowed to start service");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -32,7 +32,27 @@ public class PushMessageReceiver extends FirebaseMessagingService {
|
||||||
startService(intent);
|
startService(intent);
|
||||||
}
|
}
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
Log.e(Config.LOGTAG,"PushMessageReceiver is not allowed to start service");
|
Log.e(Config.LOGTAG,"PushMessageReceiver is not allowed to start service after receiving message");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNewToken(String token) {
|
||||||
|
if (!EventReceiver.hasEnabledAccounts(this)) {
|
||||||
|
Log.d(Config.LOGTAG,"PushMessageReceiver ignored new token because no accounts are enabled");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final Intent intent = new Intent(this, XmppConnectionService.class);
|
||||||
|
intent.setAction(XmppConnectionService.ACTION_FCM_TOKEN_REFRESH);
|
||||||
|
try {
|
||||||
|
if (Compatibility.runsAndTargetsTwentySix(this)) {
|
||||||
|
intent.putExtra(EventReceiver.EXTRA_NEEDS_FOREGROUND_SERVICE, true);
|
||||||
|
ContextCompat.startForegroundService(this, intent);
|
||||||
|
} else {
|
||||||
|
startService(intent);
|
||||||
|
}
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
Log.e(Config.LOGTAG,"PushMessageReceiver is not allowed to start service after receiving new token");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue