capacitor-community / background-geolocation

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

Android 13+ (API 33+) Needs runtime Notification Permission #102

Closed deasurv closed 1 year ago

deasurv commented 1 year ago

Describe the bug For Android 13+ to work and have Ongoing notification of BackgroundGeolocationService.java properly, we need to prompt the runtime notification permission. in lower Android versions this has not been needed.

To Reproduce If you set up and config the plugin correctly, it will have Notification access, but you should also check Allow Notifications manual from App info settings of your app.

Expected behavior Plugin must be cared about runtime Notification Permission for Android 13+

Smartphone (please complete the following information):

diachedelic commented 1 year ago

Is this not addressed in the README? https://github.com/capacitor-community/background-geolocation#android

deasurv commented 1 year ago

Yes, it is, but I don't know Java and Android too much, I don't know even where the runtime permission should be included in the code, in which file, which class, and which activity. I mean it could be better if this case was handled by the plugin itself, if possible. or maybe a straightforward example.

P.S: in Readme only told, the following permission should be included in AndroidManifest, but it's not enough. runtime permission is needed too.

diachedelic commented 1 year ago

You might be right. I suppose the plugin could request the POST_NOTIFICATIONS permission when a background watcher was first added.

But I don't have the time to implement this. The Android documentation I linked to in the README should point you in the right direction.

deasurv commented 1 year ago

Thank you for your fast response