Question
We have check-ins and check-outs in our mobile application. After transferring them into the main application, where can I see them?
Answer
Unfortunately, this data is not displayed in the base version of our product. You can find this data in the DB table (CheckInOutResult). Your question requires development skills, which are taught by our company. We store information about the visit locally on the device and then transfer it during synchronization. Data acquisition at check-in (FieldForceMobileUtilitiesV2 schema):
checkInOut: function(activityId, isCheckIn) {
Terrasoft.Geolocation.getCurrentCoordinates({
success: function(latitude, longitude) {
var checkinResultModelName = "CheckInOutResult";
var saveQueryConfig = Ext.create("Terrasoft.QueryConfig", {
modelName: checkinResultModelName,
columns: ["GpsX", "GpsY", "Activity", "IsCheckIn", "ActionTime"]
});
var checkInOutRecord = Ext.create("CheckInOutResult", {
Activity: activityId,
GpsX: String(latitude),
GpsY: String(longitude),
IsCheckIn: isCheckIn,
ActionTime: new Date()
});
checkInOutRecord.save({
queryConfig: saveQueryConfig,
success: function() {
this.changeActivityStatusByCheckInOut(isCheckIn);
},
failure: this.failureHandler
}, this);
},
failure: this.failureHandler,
scope: this
});
},
The process of getting current coordinates is described in the “FieldForceMapsModule” schema. Also, the coordinates that bpm'online receives can be controlled. An example of the current implementation of the Terrasoft.Geolocation.getCurrentCoordinates 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();
}
If there is no Internet connection or this connection is not WiFi (EDGE, 3G), then “exact” positioning will be used (GPS), otherwise data will be obtained using WiFi, caching, etc., in ways that give inaccurate representations of the location of the device, but are quite sufficient for carrying out business tasks. If you need to receive data using GPS, you can create your own implementation of the action, by analogy with 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();
}
When implementing you need to consider that this method has a number of problems:
- despite the fact that the GPS method is more accurate, the time for obtaining 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 above in the code will need to be set to more than 1 minute (60,000 ms);
- any overlap, interference in the form of any objects may not allow obtaining coordinates;
- the battery is drained faster, which is very critical for Android devices.