[jira] [Comment Edited] (CB-12251) on IOS device Corodova Geolocation GetWatchPosition not giving current location

2017-02-27 Thread Shazron Abdullah (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12251?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15751869#comment-15751869
 ] 

Shazron Abdullah edited comment on CB-12251 at 2/27/17 9:50 PM:


Thanks Kerri for your response. 

Here is a code snippet which we have used on a button click. This gives user's 
current Latitude and Logitude and using Google Or ArcGIS api we reverse Geocode 
to get the address. However I have tested it and we don't get the current 
address rather the address where I visited last. Seems like Geolocation API is 
not providing the current latitude and longitude immediately. 

Just so you know I have tried the combination all the attributes - 
EnableAccuracy, maximumage etc and nothing works. Again this issue is only on 
IOS Iphone App and our user will be on move constantly. Tried both- 
GetCurrentLocation and GetWatchPosition. 

{code}
  navigator.geolocation.watchPosition(showCurrentLocation, 
locationError, { maximumAge: 0, timeout: 3, enableHighAccuracy: true });
{code}

Your help will be greatly appreciated. 


was (Author: anshu.raj90):
Thanks Kerri for your response. 

Here is a code snippet which we have used on a button click. This gives user's 
current Latitude and Logitude and using Google Or ArcGIS api we reverse Geocode 
to get the address. However I have tested it and we don't get the current 
address rather the address where I visited last. Seems like Geolocation API is 
not providing the current latitude and longitude immediately. 

Just so you know I have tried the combination all the attributes - 
EnableAccuracy, maximumage etc and nothing works. Again this issue is only on 
IOS Iphone App and our user will be on move constantly. Tried both- 
GetCurrentLocation and GetWatchPosition. 

  navigator.geolocation.watchPosition(showCurrentLocation, 
locationError, { maximumAge: 0, timeout: 3, enableHighAccuracy: true });

Your help will be greatly appreciated. 

> on IOS device Corodova Geolocation GetWatchPosition not giving current 
> location
> ---
>
> Key: CB-12251
> URL: https://issues.apache.org/jira/browse/CB-12251
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: CordovaJS, iOS
>Affects Versions: 4.1.1
> Environment: IPhone, IOS 
>Reporter: Anshu Raj
>  Labels: features, geolocation, mydistrict
>
> Feature: We have created a Mobile App using PhoneGap and Corodova Plugin to 
> get a constantly moving user's current location. As soon as he stops, he will 
> perform an action in our App which will send his current location and we 
> convert it into Address using reverse geocoding. We then show the history of 
> user's visits. 
> We are using GetWatchPosition and GetCurrentLocation to implement above 
> feature. 
> Issue: We are not getting user's current Latitude and Longitude rather we get 
> their last Latitude and Longitude where he last visited. Hence user's visits 
> is wrongly registered based on where he was at that point of time. Somewhere 
> the API is not sending us the latest Latitude and Longitude.
> Above is working fine in Android and we are getting updated Latitude and 
> Longitude
> Please help!



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org



[jira] [Comment Edited] (CB-12251) on IOS device Corodova Geolocation GetWatchPosition not giving current location

2016-12-15 Thread Anshu Raj (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-12251?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15751869#comment-15751869
 ] 

Anshu Raj edited comment on CB-12251 at 12/15/16 5:12 PM:
--

Thanks Kerri for your response. 

Here is a code snippet which we have used on a button click. This gives user's 
current Latitude and Logitude and using Google Or ArcGIS api we reverse Geocode 
to get the address. However I have tested it and we don't get the current 
address rather the address where I visited last. Seems like Geolocation API is 
not providing the current latitude and longitude immediately. 

Just so you know I have tried the combination all the attributes - 
EnableAccuracy, maximumage etc and nothing works. Again this issue is only on 
IOS Iphone App and our user will be on move constantly. Tried both- 
GetCurrentLocation and GetWatchPosition. 

  navigator.geolocation.watchPosition(showCurrentLocation, 
locationError, { maximumAge: 0, timeout: 3, enableHighAccuracy: true });

Your help will be greatly appreciated. 


was (Author: anshu.raj90):
Thanks Kerri for your response. 

Here is a code snippet which we have used on a button click. This gives user's 
current Latitude and Logitude and using Google Or ArcGIS api we reverse Geocode 
to get the address. However I have tested it and we don't get the current 
address rather the address where I visited last. Seems like Geolocation API is 
not providing the current latitude and longitude immediately. 

Just so you know I have tried the combination all the attributes - 
EnableAccuracy, maximumage etc and nothing works. Again this issue is only on 
IOS Iphone App and our user will be on move constantly. Tried both- 
GetCurrentLocation and GetWatchPosition. 

var accLatLong = {};

navigator.geolocation.getAccurateCurrentPosition = function 
(geolocationSuccess, geolocationError, geoprogress, options) {
var lastCheckedPosition,
locationEventCount = 0,
watchID,
timerID;

options = options || {};

var checkLocation = function (position) {

lastCheckedPosition = position;
locationEventCount = locationEventCount + 1;
// We ignore the first event unless it's the only one received because 
some devices seem to send a cached
// location even when maxaimumAge is set to zero
if ((position.coords.accuracy <= options.desiredAccuracy) && 
(locationEventCount > 1)) {
clearTimeout(timerID);
navigator.geolocation.clearWatch(watchID);
foundPosition(position);
} else {
geoprogress(position);
}
};

var stopTrying = function () {
navigator.geolocation.clearWatch(watchID);
foundPosition(lastCheckedPosition);
};

var onError = function (error) {
clearTimeout(timerID);
navigator.geolocation.clearWatch(watchID);
geolocationError(error);
   };

var foundPosition = function (position) {
geolocationSuccess(position);
debugger
accLatLong = position;
//{
//"Latitude": position.coords.latitude,
//"Longitude": position.coords.longitude,
//}
};

if (!options.maxWait) options.maxWait = 1; // Default 10 seconds
if (!options.desiredAccuracy) options.desiredAccuracy = 20; // Default 20 
meters
if (!options.timeout) options.timeout = options.maxWait; // Default to 
maxWait

options.maximumAge = 0; // Force current locations only
options.enableHighAccuracy = true; // Force high accuracy (otherwise, why 
are you using this function?)

watchID = navigator.geolocation.watchPosition(checkLocation, onError, 
options);
timerID = setTimeout(stopTrying, options.maxWait); // Set a timeout that 
will abandon the location loop
};


Your help will be greatly appreciated. 

> on IOS device Corodova Geolocation GetWatchPosition not giving current 
> location
> ---
>
> Key: CB-12251
> URL: https://issues.apache.org/jira/browse/CB-12251
> Project: Apache Cordova
>  Issue Type: Bug
>  Components: CordovaJS, iOS
>Affects Versions: 4.1.1
> Environment: IPhone, IOS 
>Reporter: Anshu Raj
>Priority: Critical
>  Labels: features, geolocation, mydistrict
>
> Feature: We have created a Mobile App using PhoneGap and Corodova Plugin to 
> get a constantly moving user's current location. As soon as he stops, he will 
> perform an action in our App which will send his current location and we 
> convert it into Address using reverse geocoding. We then show the history of 
> user's visits. 
> We are using GetWatchPosition and GetCurrentLocation to implement above 
> feature. 
> Issue: We are not getting user's current