capacitor-community / background-geolocation

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

Not receiving location on a specific device #36

Closed zdevaty closed 2 years ago

zdevaty commented 2 years ago

Describe the bug I have migrated from mauron85's cordova plugin to this one. I tested the app in virtual device with Android 11 and it worked well. But when I tested it on a physical device (previously working with the app), it says "Google Play Store is missing".

Other apps on this device work well with location. Other devices with this app work well. This error occurs even after OS reinstall.

I don't really think it is a bug, but I don't have any other idea what could cause it. I think it's something with the UnifiedNlp (microG), but I am not really experienced in this area. Do you have any suggestions?

To Reproduce

  1. Subscribe to location updates
  2. The location won't be ever given and logcat says W/GooglePlayServicesUtil: Google Play Store is missing.

Smartphone (please complete the following information):

diachedelic commented 2 years ago

The variables.gradle file in your project should specify a version for the play services dependency, like so:

    ...
    playServicesLocationVersion =  '17.0.0'
}

This variable, $playServicesLocationVersion, is used in the plugin's build.gradle to install the correct dependency.

zdevaty commented 2 years ago

Thank you for your reply! I found out that 17.0.0 is the default version and 18.0.0 is (probably) the newest version. But what is the best practice? How to find the correct version? I tried 15.0.0 to 18.0.0 which just led just to some variations in the error messages.

Can you, please, link me to some documentation for that?

diachedelic commented 2 years ago

17.0.0 should work OK.

I would try this:

zdevaty commented 2 years ago

Thanks. Tried that now, upgraded Gradle, tried again, still the same problem. I think I will suspect the phone for now.

jasonfish568 commented 2 years ago

Encountering the same problem and suspecting this plugin requires google services installed on the devices. Could you confirm that without gms this plugin simply won't work? Migrating from mauron85's plugin as it no longer works with capacitor when building signed apks.

zdevaty commented 2 years ago

We resolved that issue by reinstalling the LineageOS on the phone. I didn't investigate further.

jasonfish568 commented 2 years ago

Thanks for the reply. I figured out that this plugin uses Google Play Location APIs to provide service. I combined mauron85's plugin with this one and now it worked.