From 7f992533ee30fdb6353e979705b7ee3650970561 Mon Sep 17 00:00:00 2001 From: Martin Dobias Date: Mon, 6 May 2024 16:52:21 +0200 Subject: [PATCH] Small tracking notification improvements --- app/android/res/drawable/ic_notification.xml | 24 +++++++++++++ .../PositionTrackingService.java | 10 +++--- ...d-foreground-service-notification-icon.svg | 36 +++++++++++++++++++ 3 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 app/android/res/drawable/ic_notification.xml create mode 100644 app/icons/android-foreground-service-notification-icon.svg diff --git a/app/android/res/drawable/ic_notification.xml b/app/android/res/drawable/ic_notification.xml new file mode 100644 index 0000000000..f9810a82dc --- /dev/null +++ b/app/android/res/drawable/ic_notification.xml @@ -0,0 +1,24 @@ + + + + + + + + \ 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 096b577934..5319ab5273 100644 --- a/app/android/src/uk/co/lutraconsulting/PositionTrackingService.java +++ b/app/android/src/uk/co/lutraconsulting/PositionTrackingService.java @@ -143,22 +143,22 @@ public int onStartCommand( Intent intent, int flags, int startId ) { NotificationChannel serviceChannel = new NotificationChannel( CHANNEL_ID, "Foreground Service Channel", - NotificationManager.IMPORTANCE_HIGH + NotificationManager.IMPORTANCE_LOW ); NotificationManager manager = getSystemService( NotificationManager.class ); manager.createNotificationChannel( serviceChannel ); // Build notification for position tracking - Intent notificationIntent = new Intent( this, PositionTrackingService.class ); + Intent notificationIntent = new Intent( this, InputActivity.class ); PendingIntent pendingIntent = PendingIntent.getActivity( this, 0, notificationIntent, PendingIntent.FLAG_IMMUTABLE ); Notification notification = new Notification.Builder( this, CHANNEL_ID ) - .setContentTitle( getText( R.string.notification_title ) ) - .setContentText( getText( R.string.notification_message ) ) + .setSmallIcon( R.drawable.ic_notification ) + .setContentTitle( "Tracking" ) + .setForegroundServiceBehavior( Notification.FOREGROUND_SERVICE_IMMEDIATE ) .setContentIntent( pendingIntent ) - .setTicker( getText( R.string.ticker_text ) ) .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 new file mode 100644 index 0000000000..2d9f21df7a --- /dev/null +++ b/app/icons/android-foreground-service-notification-icon.svg @@ -0,0 +1,36 @@ + + + + + + + + + +