1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-08-24 16:21:16 +02:00

Bangle.js: extending intents functionality (fix). Use startForegroundService only on API level 26 and up.

This commit is contained in:
Ganblejs 2022-09-27 17:09:55 +02:00
parent de9cf23464
commit c31471c9b8

View File

@ -28,6 +28,7 @@ import android.graphics.Paint;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.util.Base64;
import android.widget.Toast;
@ -706,7 +707,11 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
getContext().startService(in);
break;
case "foregroundservice": // Should this be implemented differently, e.g. workManager?
getContext().startForegroundService(in);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
getContext().startForegroundService(in);
} else {
getContext().startService(in);
}
break;
default:
LOG.info("Targeting '"+target+"' isn't implemented or doesn't exist.");