Question
Terrasoft.Geolocation.getCurrentCoordinates is used to determine GPS coordinates on an Android mobile device, which for some reason does not launch the GPS module (the GPS start indicator does not appear in the UI of the device).
Is it possible to collect the coordinate information without enabling this module (maybe a coordinate cache?)
Answer
Yes, the GPS service can be disabled. The data can be collected based on mobile device settings (from Wi-Fi points), or it can be cached.
In fact, the way bpm'online collects the coordinates can be controlled. Below is an example of the current implementation of the mentioned method:
getCurrentCoordinates: function(config) { var enableHighAccuracy = !Terrasoft.Connection.isOnline() || Terrasoft.Connection.getType() !== Terrasoft.ConnectionTypes.WiFi; var geo = Ext.create("Ext.util.Geolocation", { autoUpdate: false, allowHighAccuracy: enableHighAccuracy, timeout: 60000, listeners: { scope: this, locationupdate: function(geo) { Ext.callback(config.success, config.scope, [geo.getLatitude(), geo.getLongitude()]); }, locationerror: function(geo, timeout, permissionDenied, locationUnavailable, message) { … } } }); geo.updateLocation(); }
At the moment, if there is no Internet connection or if the device is not connected to Wi-Fi (for example, you're using EDGE or 3G), then the “accurate” positioning will be used (GPS), but otherwise the data will be obtained using Wi-Fi, caching, etc., providing less accurate location information, but sufficient for given business tasks.
Nevertheless, if you need to receive data using GPS in all cases, you can create your own implementation of the action, similar to how it is implemented in bpm'online:
getCurrentCoordinates: function(config) { var geo = Ext.create("Ext.util.Geolocation", { autoUpdate: false, allowHighAccuracy: true, timeout: 60000, listeners: { scope: this, locationupdate: function(geo) { Ext.callback(config.success, config.scope, [geo.getLatitude(), geo.getLongitude()]); }, locationerror: function(geo, timeout, permissionDenied, locationUnavailable, message) { … } } }); geo.updateLocation(); }
This method has a number of problems:
- despite the fact that the GPS method is more accurate, the time for receiving such data can be quite long (up to 10-15 minutes).
- the waiting time for receiving the response should be increased, i.e. the timeout parameter in the code above will need to be set to more than 1 minute (60,000 ms).
- this method may decrease your Android device's battery life.
hi Kirill Potapkin,
Could you please assist with where to add this schema?
1. When does this schema gets triggered?
2. what is geo.updatelocation method performs?
3. How to capture the GPS co-ordinates and store it in a field in custom section.
BR,
Bhoobalan Palanivelu.