[SOLVED] PhoneGap Geolocation not working

Forum to discuss the new web client version of Servoy.

[SOLVED] PhoneGap Geolocation not working

Postby francisco.garcia » Tue May 14, 2019 7:11 pm

Hi. I'm trying to implement the geolocation plugin that comes included in the Phonegap Web Component, but when i execute the "getCurrentPosition" method i have the following error:

error getting geolocation: Failed to execute 'getCurrentPosition' on 'Geolocation': The callback provided as parameter 1 is not a function

I tried everyting. I have also duplicate the plugin and try some modifications directly on the code of it, with no luck.
I also downloaded the servoy mobile sample solution that is uploaded in github and i get the same error.

This is my code
Code: Select all
/**
* @param {JSEvent} event
*
* @properties={typeid:24,uuid:"0B7600D8-187C-4F72-8E8B-C61037C93108"}
*/
function onDoubleClick(event) {
   plugins.svyphonegapLocation.getCurrentPosition(getLocationSuccess,getLocationError)
}

/**
* @param pos
*
* @properties={typeid:24,uuid:"B7D43BF6-5C28-45F7-9812-D02AAA34F22A"}
*/
function getLocationSuccess(pos) {
   plugins.webnotificationsToastr.success('Posicion - Lat: '+pos.coords.latitude+" - Long: "+pos.coords.longitude)
}

/**
* @param pos
*
* @properties={typeid:24,uuid:"965115D3-4159-4E7A-831B-ED422883A3E3"}
*/
function getLocationError(pos) {   
   
}

Please, any kind of help or tip would help.
Thanks.
Last edited by francisco.garcia on Mon Oct 14, 2019 1:58 pm, edited 1 time in total.
francisco.garcia
 
Posts: 16
Joined: Tue Jan 09, 2018 3:40 pm

Re: PhoneGap Geolocation not working

Postby nic » Wed Sep 25, 2019 1:37 pm

Perhaps you can first test if the location service is available on the device:

/**
* Starting the location service
* @properties={typeid:24,uuid:"24EFE264-6D40-4BB0-9D61-FC9B65E5B7C8"}
*/
function startLocationService() {
plugins.svyphonegapLocation.isSupported(scopes.crm.getLocationSupport)
}

/**
* Callback if location service is supported
* @properties={typeid:24,uuid:"CDF9FE70-2B46-4687-AF23-C52A87496DF6"}
*/
function getLocationSupport(res) {
locationSupport = res;

if (locationSupport) {
var options = { maximumAge: 60000, timeout: 5000, enableHighAccuracy: true }
plugins.svyphonegapLocation.getCurrentPosition(getGeolocationSuccess, getGeolocationError, options);
}
}
nic
 
Posts: 21
Joined: Fri Nov 16, 2018 10:54 am


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 4 guests