Cordova GeoLocation API failing in Android M Beta OS

54 views
Skip to first unread message

Ritika Mathur

unread,
Jun 30, 2015, 2:09:38 PM6/30/15
to phon...@googlegroups.com

Cordova's Geolocation API is not working on Android device running with Android M beta OS. While other API's like network, device, camera, etc.. works fine in this beta OS. Only GeoLocation API doesn't work. Is this is an API issue? (location option was enabled under Settings>App_Name>Permissions. But my app is not shown under Settings>Location)

Note: Geolocation App works fine on the same app, installed over Android 5 & below OS versions.

I am using Cordova CLI version 4.3.0.

geolocation.getCurrentLocation fails with error as "User denied geolocation".where as i haven't denied any location tracking permission on device.

Below is my code snippet to get current location

window.navigator.geolocation.getCurrentPosition(
 
function (position) {
 log
("got the location " + position);}
function (error) {
 
self.showErrorMessage(NO_LOCATIONS_FOUND);
 
switch(error.code)
 
{
 
case error.PERMISSION_DENIED:
 logErr
("User denied the request for Geolocation.");
 
break;
 
case error.POSITION_UNAVAILABLE:
 logErr
("Location information is unavailable.");
 
break;
 
case error.TIMEOUT:
 logErr
("The request to get user location timed out.");
 
break;
 
case error.UNKNOWN_ERROR:
 logErr
("An unknown error occurred.");
 
break;
 
}
 findBranchView
.showNoLocationServiceMessage();
},
{
 
//for reference
 
//https://groups.google.com/forum/#!topic/phonegap/ESrHAjFHgFU
 
//http://www.badrit.com/blog/2013/9/25/javascript-and-geolocation-tricks
 enableHighAccuracy
: true,
 timeout
: 30000
}

);

Thanks in advance.

Rob Willett

unread,
Jun 30, 2015, 2:26:06 PM6/30/15
to phon...@googlegroups.com
Do you get the same error with watchposition? I don't have an android phone with that version of the OS do can't test it.

However I think watchposition is more useful and it's relatively easy to emulate getwatchposition from watchposition.
--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
---
You received this message because you are subscribed to the Google Groups "phonegap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phonegap+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

jcesarmobile

unread,
Jun 30, 2015, 5:08:07 PM6/30/15
to phon...@googlegroups.com
File an issue on the cordova jira page, so developers can see it and fix it before the final release

Ritika Mathur

unread,
Jul 3, 2015, 5:28:39 AM7/3/15
to phon...@googlegroups.com
Hi Rob,

WatchPostion also fails  with error as "User denied geolocation" .
Where as geolocation seems to work fine with Android L , Kitkat and older OS

Rob Willett

unread,
Jul 3, 2015, 5:31:22 AM7/3/15
to phon...@googlegroups.com
This sounds like a bug, file an issue is all I can suggest. Bit annoying...

Rob

mayor

unread,
Jul 3, 2015, 1:21:28 PM7/3/15
to phon...@googlegroups.com
confirmed on my Nexus 9 with M

Rob Willett

unread,
Jul 3, 2015, 1:34:11 PM7/3/15
to phon...@googlegroups.com
Confirmed as working or as an issue?

On Fri, 3 Jul 2015 at 18:21, mayor <kevin...@gmail.com> wrote:
confirmed on my Nexus 9 with M

--

mayor

unread,
Jul 3, 2015, 1:42:53 PM7/3/15
to phon...@googlegroups.com
confirmed as an issue.  I get the same "User denied geolocation".

Martin Hollerweger

unread,
Jul 3, 2015, 3:00:04 PM7/3/15
to phon...@googlegroups.com
I have the same issue on Android M with my Nexus 5 
Reply all
Reply to author
Forward
0 new messages