capacitor-community / background-geolocation

A Capacitor plugin that sends you geolocation updates, even while the app is in the background.
MIT License
188 stars 57 forks source link

`backgroundMessage` and `backgroundTitle` and custom icon has no effect on notification #37

Closed josiahbryan closed 2 years ago

josiahbryan commented 3 years ago

Describe the bug Passing backgroundMessage and backgroundTitle to addWatcher has no effect (does not change strings on the actual notification.) Also, the specified <string> (capacitor_background_geolocation_notification_icon) does not change the actual icon used. Also, touching the notification does NOT bring the app to foreground - instead it goes to app settings in the system UI.

To Reproduce Steps to reproduce the behavior:

  1. Install version 1.0.3 (latest from npm)
  2. Call .addWatcher with custom backgroundMessage and backgroundTitle screens. Set strings.xml with custom icon
  3. Put app in background
  4. Check notification - see strings aren't set and icon is not set.
  5. Touch the notification - see it goes to App Settings in System UI, not the actual app

Expected behavior Title and body of notification should match strings given in item 2 above. Icon should batch documented icon in strings.xml. Touching the notification should open the app (bring to foreground)

Screenshots Available on request

Desktop (please complete the following information): N/A

Smartphone (please complete the following information):

Additional context On request

diachedelic commented 3 years ago

How odd. Please set a breakpoint here and let me know what you find.

josiahbryan commented 3 years ago

@diachedelic not sure how to set a breakpoint on the plugin's java file - it doesn't show up as an available file in Android Studio when I do "shift shift" and search everything for "Background..." :) thoughts? image

diachedelic commented 3 years ago

Looks like capacitor-background-geolocation is missing?

josiahbryan commented 3 years ago

It does look like that doesn't it? However it is listed in package.json and it is working when access to be the plugin API, and I have ran npx cap sync so not sure what else to do

On Tue, Oct 5, 2021, 12:42 AM diachedelic @.***> wrote:

Looks like capacitor-background-geolocation is missing?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/capacitor-community/background-geolocation/issues/37#issuecomment-934084664, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEZELEV2FCSKODBKKCCMFTUFKF4PANCNFSM5FK4F23A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

diachedelic commented 3 years ago

Perhaps Build -> Clean Project in Android Studio?

josiahbryan commented 3 years ago

Good idea - that at least caused it to show up in the app tree. However, no change in functionality of the bug:

Android studio tree now: image

diachedelic commented 3 years ago

But you can set a breakpoint now.

mxbos commented 2 years ago

I had the same behavior.

Does it work when you remove the setting: “capacitor_background_geolocation_notification_icon” from strings.xml? (it will fallback to default). If this does work, i guess your icon is not compatible. Select "Notification Icons" as the Icon Type when creating the Image Asset in Android Studio (or create a Vector Asset in Android Studio). Set the name of your asset in strings.xml, something like:

<string name="capacitor_background_geolocation_notification_icon">drawable/ic_my_tracking_icon</string>