Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Genero Mobile - obtaining lat/lng coordinates  (Read 7294 times)
Tim B.
Posts: 1


« on: June 02, 2020, 10:51:47 am »

Our mobile app currently obtains the lan & lng at regular intervals using a FRONTCALL.  This works fine except for the delay of several seconds, which can be a little annoying for our drivers.  I was advised several years ago that Cordova plugins could solve this issue because they can be called asynchronously.   Can anyone recommend a plugin and/or method?  Is Cordova still the recommended route? 

Alternatively, have there been any thoughts about being able to call a 4Js function asynchronously to achieve the same result with FRONTCALL?

Thanks
Leo S.
Four Js
Posts: 129


« Reply #1 on: June 04, 2020, 12:07:28 am »

Hi Tim, I had a look at the official plugin at https://github.com/apache/cordova-plugin-geolocation.
However I noticed that under Android there is no native part for the geolocation .... one would need to use a webcomponent in order to retrieve coordinates.
So I forked the plugin under
https://github.com/leopatras/cordova-plugin-geolocation and added some java code to do roughly the same what our built-in frontcall does.
The advantage to our built-in is that the cordova frontcall returns immediately and later on the cordovacallback action is triggered ->you retrieve the coordinates with the cordova getAllCallbackData frontcall.
This allows the Genero program to continue processing and being user responsive .
If you leave however the current dialog and switch to another one and still want to be able to get the cordova notifications you need to add the cordovacallback action as well in this new dialog.
For Linux/Mac the build of the plugin should be straightforward:
Code
  1. git clone https://github.com/leopatras/cordova-plugin-geolocation.git
  2. cd cordova-plugin-geolocation/fgldemo/simple
  3. make gma.build
  4. make gma.install
  5.  
On Windows one would need to add a .bat script or to use a bash (path separators probably need an update then)

On my Nokia 6.1 the first getGeolocation needs about 3 to 4 seconds, subsequent calls are faster (1-2 seconds).
Let us know if you are able to build the demo, it can be refined later on to use a RECORD for the return values , the plugin can be tuned to use parameters for the wanted accuracy etc.
Regards, Leo
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines