harshad.p, hello!
This answer for Wialon Hosting or Local.
If You are looking for simple solution and don't want to explore routes (http://sdk.wialon.com/wiki/en/sidebar/r … oute/route) - You can do it in such way:
1. For example You have one unit and 2 geofences (Start and Finish).
2. Create 2 notifications with trigger Geofence. One of type Outside geofence with Start geofence selected, the second - Inside geofence with Finish geofence selected. Set action Show online notification.
3. Subscribe to units' and resources' messages (http://sdk.wialon.com/wiki/en/sidebar/r … data_flags) using such request:
svc=core/update_data_flags¶ms={"spec":[
{
"type":"col",
"data":[<resource_id>, <unit_id>],
"flags":0x21, // messages + base (at least)
"mode":1
}
]}
4. Then Your app should send avl_evts requests (http://sdk.wialon.com/wiki/en/sidebar/r … s/avl_evts) every 3 - 10 seconds and process response if it contains triggered notifications (look parameter "tp": "unm"). Triggered notification's json will look like this:
{
"tm": 1465557949,
"events": [
{
"i": 763661,
"t": "m",
"d": {
"t": 1465557947,
"f": 896,
"tp": "unm",
"name": "Notification Start",
"txt": "TestUnit left Start. At 2016-06-10 14:25:47 it moved with speed 30 mph near 'Morgan St, Everett, MA 02149, USA'",
"color": "",
"url": "",
"unit": 974873,
"blink": 0,
"x": -71.0588824233,
"y": 42.4117158806,
"nid": 13,
"p": {}
}
}
]
}
You will be able to distinguish notification of started unit and notification of finished unit.
Also it may be useful for You to try notification action Send request.
When notification triggers - get or post request can be sent to Your server with some data.
And Your server can handle such requests.
As for percentage of unit progress between geofences - here is some simple draft method:
1. You can calculate distance between 2 geofences (according to routing).
2. When Notification Start triggered You can save unit's mileage counter's value to some variable.
3. On every unit's new message (or better every 10th message if they are often) increase some virtual mileage counter by adding difference between current mileage counter value and saved value at start.
4. Then percentage of unit's progress can be calculated: (virtual mileage counter value / full distance between geofences) * 100%
Head of Wialon Local Department
Gurtam