[
https://issues.apache.org/jira/browse/CB-10278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15074914#comment-15074914
]
ASF GitHub Bot commented on CB-10278:
-------------------------------------
Github user vladimir-kotikov commented on a diff in the pull request:
https://github.com/apache/cordova-plugin-geolocation/pull/63#discussion_r48596899
--- Diff: www/android/geolocation.js ---
@@ -38,21 +39,29 @@ module.exports = {
},
watchPosition: function(success, error, args) {
+ var pluginWatchId = utils.createUUID();
+
var win = function() {
var geo =
cordova.require('cordova/modulemapper').getOriginalSymbol(window,
'navigator.geolocation');
- geo.watchPosition(success, error, {
+ pluginToNativeWatchMap[pluginWatchId] =
geo.watchPosition(success, error, {
enableHighAccuracy: args[1]
});
};
exec(win, error, "Geolocation", "getPermission", []);
+
+ return pluginWatchId;
},
- clearWatch: function(success, error, args) {
+ clearWatch: function(pluginWatchId) {
var win = function() {
- var geo =
cordova.require('cordova/modulemapper').getOriginalSymbol(window,
'navigator.geolocation');
- geo.clearWatch(args[0]);
+ var nativeWatchId = pluginToNativeWatchMap[pluginWatchId];
--- End diff --
What will happen if there is no `pluginWatchId` in
`pluginToNativeWatchMap`? How native `geo.clearWatch` will behave if called
with `undefined?`
> geolocation watchPosition doesn't return watchID string
> -------------------------------------------------------
>
> Key: CB-10278
> URL: https://issues.apache.org/jira/browse/CB-10278
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android, Plugin Geolocation
> Environment: Android 4.4 on samsung galaxy s5.
> Android 5.0 on samsung galaxy s5.
> Reporter: Nicholas Tsaoucis
> Labels: Android, Triaged
>
> With the new version of the geolocation plugin (-r1.0.1- 2.0.0) when calling
> watchPosition no watchID is returned as a string. only undefined is returned.
> This makes it impossible to call clearWatch as we don't have the watchID to
> use in the clearWatch call.
> I rolled back to version -r1.0.0- r1.0.1 and it works properly.
> ~edit
> The issue is actually with the master branch (version 2.0.0)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]