Closed HammasMajeed closed 3 months ago
Do you think they can work together? You are the expert at this point.
I think they should work together.. But it is Java coding issue. I am no expertise in Java :(.. I can remove @capacitor/geolocation from my code because it is being used for getting current location only. If capacitor-community/background-geolocation can also give current location without adding a watcher. This will be a way to solve this problem.. But I did not find any method to get current location only in documentation. Can you suggest how can I do that?
The method in the documentation is valid. Have you tried it?
Hi! This issue resolved when I updated my project to capacitor version 5. Thanks
My app was using @capacitor/geolocation. The only purpose was to get current location of user. After that I needed to get the location continuously in background also. The problem arose when capacitor-community/background-geolocation integrated with code run on Android . It was working fine in iOS. But in android it is giving: Caused by: java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.FusedLocationProviderClient, but class was expected (declaration of 'com.google.android.gms.location.FusedLocationProviderClient' appears in /data/app/~~T4_h8WPsBF1KaVyZb0o7JQ==/io.ionic.mbntasker-wmKD2k-rrZemGe7I-LpPKQ==/base.apk) at com.capacitorjs.plugins.geolocation.Geolocation.sendLocation(Geolocation.java:51) at com.capacitorjs.plugins.geolocation.GeolocationPlugin.getPosition(GeolocationPlugin.java:155) at com.capacitorjs.plugins.geolocation.GeolocationPlugin.getCurrentPosition(GeolocationPlugin.java:86)
with little research I found that there is a mismatch between the expected type of a class/interface and the actual type encountered at runtime. In this case, the code is expecting a class but found an interface instead. Specifically, the error occurs in the Geolocation plugin within my Android app.
To Reproduce: Steps to reproduce the behavior:
Smartphone