Hi, i am using @capacitor/geolocation to get the longitude and latitude of the user’s location. Here is the code
import * as CapacitorGeolocation from “@capacitor/geolocation”
CapacitorGeolocation?.Geolocation?.getCurrentPosition().then((coordicates: any) => { console.log(coordicates)
}).catch((err) => {console.log(err)}). ?
It is working fine on android device But throwing error on windows build made with electron.
I used following code to check permissions in windows build
CapacitorGeolocation?.Geolocation?.checkPermissions().then(res => {console.log(“Res”, res)}).catch(err => {console.log(“Err”, err)})
it responds with following
{
“location”: “granted”,
“coarseLocation”: “granted”
}
I am getting the following error in windows build
{
code:2
message:Network location provider at ‘https://www.googleapis.com/’ : ERR_HTTP_RESPONSE_CODE_FAILURE.
proto:
The location is not enabled into the plateform where you test your app. May be test it on mobile plateform or emulator. I am faced this error when I have try to run my app on the browser but it look like this fonctionnality is not available on that plateform.
when i run the app using ng serve app is started in google chrome. Longitude and lattitude points are obtained there (in chrome) .
And when i generated the windows build with electron,
it is not working in the windows build.
Windows build file is opened and it looks like it is a widget like something of chrome becuase it debugging tools are same as chrome.
Location is enabled. becuase there is a function named as checkPermissions . It is returning the
{
“location”: “granted”,
“coarseLocation”: “granted”
}.
And when i run the app using ng serve it runs the app in chrome and coordinates are obtained there. It is working fine in the chrome but when i make the windows build using electron it is creating an issue.