From e6c62a6c205c462142c01b8c2e3e6c4fb276031f Mon Sep 17 00:00:00 2001 From: asiermusa <32843723+asiermusa@users.noreply.github.com> Date: Sun, 8 May 2022 10:25:44 +0200 Subject: [PATCH 1/2] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1176bdd..53b53dd 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,10 @@ BackgroundGeolocation.addWatcher( // The title of the notification mentioned above. Defaults to "Using // your location". backgroundTitle: "Tracking You.", - + + // The color of the notification icon when app is in the background. Defaults to black. + backgroundIconColor: "#000000", + // Whether permissions should be requested from the user automatically, // if they are not already granted. Defaults to "true". requestPermissions: true, From 9a1f5daf9d58e514bb62484a6d4174efa8633c43 Mon Sep 17 00:00:00 2001 From: asiermusa <32843723+asiermusa@users.noreply.github.com> Date: Sun, 8 May 2022 10:28:13 +0200 Subject: [PATCH 2/2] Update BackgroundGeolocation.java Notification icon color option added --- .../BackgroundGeolocation.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/android/src/main/java/com/equimaps/capacitor_background_geolocation/BackgroundGeolocation.java b/android/src/main/java/com/equimaps/capacitor_background_geolocation/BackgroundGeolocation.java index b6f2820..4d41ad5 100644 --- a/android/src/main/java/com/equimaps/capacitor_background_geolocation/BackgroundGeolocation.java +++ b/android/src/main/java/com/equimaps/capacitor_background_geolocation/BackgroundGeolocation.java @@ -4,6 +4,7 @@ import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; +import android.graphics.Color; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.ComponentName; @@ -83,6 +84,8 @@ public void onSuccess(Location location) { } Notification backgroundNotification = null; String backgroundMessage = call.getString("backgroundMessage"); + int color = Color.parseColor(call.getString("backgroundIconColor")); + if (backgroundMessage != null) { Notification.Builder builder = new Notification.Builder(getContext()) .setContentTitle( @@ -92,6 +95,7 @@ public void onSuccess(Location location) { ) ) .setContentText(backgroundMessage) + .setColor(color) .setOngoing(true) .setPriority(Notification.PRIORITY_HIGH) .setWhen(System.currentTimeMillis());