I know this question has been asked before, but I've tried all the proposed solutions and nothing seems to work!
I'm working on a mobile app built with Phonegap (+Angular but I don't think that's important). In this app I'm using the geolocation plugin. More specifically my config.xml looks like the following:
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "......"
version = "1.0.0" >
<name>.....</name>
<preference name="permissions" value="none"/>
<preference name="orientation" value="default" />
<preference name="target-device" value="universal" />
<preference name="phonegap-version" value="3.6.3" />
<gap:plugin name="org.apache.cordova.geolocation" />
<gap:plugin name="com.phonegap.plugins.PushPlugin" version="2.4.0" />
<gap:plugin name="org.apache.cordova.network-information" />
<gap:plugin name="org.apache.cordova.statusbar" />
<gap:plugin name="org.apache.cordova.device" />
<gap:plugin name="org.transistorsoft.cordova.background-geolocation"/>
</widget>
There are times that I want to get the current position of the user, so I'm doing it as follows:
navigator.geolocation.getCurrentPosition(function (position) {
.....
}, function (error) {}, {
enableHighAccuracy: true,
maximumAge: 30000,
timeout: 10000
});
This is working fine on iOS devices and it even works on the ripple emulator for Android.
But when I try to run the app on Android and more specifically on Nexus 4 and 5, the geolocation doesn't seem to work. It's not that it's giving me an error, it's just trying to retrieve the position without any luck.
However, all the other apps that are using geolocation and also the geolocation in the browser is working perfectly fine!
I would also like to note that I'm using Phonegap Build to build the app.
Does anyone know how I can fix this problem? Did anyone have the same issue?