diff --git a/app/android/res/drawable/ic_notification.xml b/app/android/res/drawable/ic_notification.xml index f9810a82d..b1bfb2f7c 100644 --- a/app/android/res/drawable/ic_notification.xml +++ b/app/android/res/drawable/ic_notification.xml @@ -3,22 +3,8 @@ android:viewportHeight="234" android:width="234dp" android:height="234dp"> - - - - - - + \ No newline at end of file diff --git a/app/android/src/uk/co/lutraconsulting/PositionTrackingService.java b/app/android/src/uk/co/lutraconsulting/PositionTrackingService.java index 5d19d5062..3d384e0a4 100644 --- a/app/android/src/uk/co/lutraconsulting/PositionTrackingService.java +++ b/app/android/src/uk/co/lutraconsulting/PositionTrackingService.java @@ -154,13 +154,17 @@ public int onStartCommand( Intent intent, int flags, int startId ) { PendingIntent pendingIntent = PendingIntent.getActivity( this, 0, notificationIntent, PendingIntent.FLAG_IMMUTABLE ); - Notification notification = new Notification.Builder( this, CHANNEL_ID ) + Notification.Builder notificationBuilder = new Notification.Builder( this, CHANNEL_ID ) .setSmallIcon( R.drawable.ic_notification ) .setContentTitle( "Tracking in progress" ) .setColor( getResources().getColor( R.color.grassColor ) ) - .setForegroundServiceBehavior( Notification.FOREGROUND_SERVICE_IMMEDIATE ) - .setContentIntent( pendingIntent ) - .build(); + .setContentIntent( pendingIntent ); + + if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ) { // only Android >= 12 + notificationBuilder.setForegroundServiceBehavior( Notification.FOREGROUND_SERVICE_IMMEDIATE ); + } + + Notification notification = notificationBuilder.build(); startForeground( SERVICE_ID, notification ); diff --git a/app/icons/android-foreground-service-notification-icon.svg b/app/icons/android-foreground-service-notification-icon.svg index 2d9f21df7..c10ef3e7a 100644 --- a/app/icons/android-foreground-service-notification-icon.svg +++ b/app/icons/android-foreground-service-notification-icon.svg @@ -5,32 +5,38 @@ viewBox="0 0 234 234" fill="none" version="1.1" - id="svg30" + id="svg24" + sodipodi:docname="android-foreground-service-notification-icon.svg" + inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"> + - - - - - - + id="defs28" /> +