0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-11-24 04:05:13 +00:00
This commit is contained in:
Oizaro 2020-09-20 01:21:47 +02:00
parent a9ee2e5065
commit 1ccd603860
2 changed files with 6 additions and 3 deletions

View file

@ -36,11 +36,10 @@ public class ForegroundServiceContext extends ContextWrapper {
if (!isIgnoringBatteryOptimizations() && !isAppOnForeground()) {
Log.d(TAG, "Starting in foreground mode.");
service.putExtra(EXTRA_FOREGROUND, true);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return super.startService(service);
}
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
return super.startForegroundService(service);
} else {
return super.startService(service);
}
}
return super.startService(service);

View file

@ -20,6 +20,7 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@ -27,6 +28,8 @@ import android.os.Messenger;
import android.os.RemoteException;
import android.util.Log;
import androidx.annotation.RequiresApi;
import org.microg.gms.checkin.LastCheckinInfo;
import org.microg.gms.common.ForegroundServiceContext;
import org.microg.gms.common.PackageUtils;
@ -108,6 +111,7 @@ class PushRegisterHandler extends Handler {
return PendingIntent.getBroadcast(context, 0, intent, 0);
}
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void handleMessage(Message msg) {
if (msg.what == 0) {