Share My Creation Travel Trax MVP for Travel & Subsistence Logs

Hi there

Demo on Netlify

Why?

You have employees who travel and claim t&s. The kilometers claimed are in-accurate at worst. You need something that they can use in their mobile devices. They "start" a trip, this records their current location and time. After they finish their trip, they "finish" the trip. This logs their "path", calculating the actual distance travelled.

They should see their location on a map in realtime. At least every 5 minutes, when a work trip is running, their "movement" should be recorded as it times, they might divert using other routes etc. Their "travel log" should be exportable to excel and should be shown in a calendar when choosing a date range. An employee can also cancel a trip.

Development Platform for MVP

BANanoVuetifyAD3 - Version 7.34
GoogleMaps - plot current location in real time & distance travelled calculation using DistanceMatrixService
IndexedDB - storing user profile, trips and movements in real-time
BANano - current position recording with BANanoGeoPosition etc
VFlexDialog -

Preview

01.jpg
02.jpg
03.jpg
04.jpg
05.jpg



06.jpg
07.jpg
08.jpg
09.jpg
10.jpg
11.jpg



Before Use: You will need to get your own Google Maps key, open the googlemaplayout and update the key property:

1662576864270.png


Source Code

$15

 
Last edited:

alwaysbusy

Expert
Licensed User
Longtime User
Cool app! We're writing a similar one for our clients. I wondered how you tackled the problem where JavaScript can not get the GeoLocation when your phone is in sleep mode (or sometimes even when the browser is going inactive), but I see you have the same problem while testing it.

I know there is a 'proposition' to allow this is in the work for years (new API GeoFence) to allow it with Service Workers but as for now, we have not been able to make it a 'reliable' enough solution. The GEO API in browsers is great for pointing out your current location e.g. on a map but unfortunately not enough for tracking yet.

1. Started the trip, phone goes in pocket
2. a 20 minute ride to get some errands (10km)
3. finished the trip when I arrived at home
-> distance 0

1658142944242.png
1658142982648.png


We did notice the same problem. Even with a timer, all GeoLocation calls are buffered and are all called at once when the phone becomes active again (giving like 10 times the same current location of course).

Alwaysbusy
 

Mashiane

Expert
Licensed User
Longtime User
@alwaysbusy we had the same issue too of the zero km distance and then we realized that we had to do it linear. You travel to and then record that leg and then start a new trip and record that leg.

Because the distance calculated it based on start and end kilometers. Which when you travel from and to the same point makes it zero. So using that approach worked when 2 trips were recorded.

So thus we resoluted to record the 5 minute intervals of the location with a hope that we can later 'sum' these up. This could perhaps be done by drawing a polyline on the map and calculating its distance.

Still it would be nice to have a fully offline map. Most of these work with AGPS that is Assisted GPS which brings in another angle to the whole scene when satellite GPS is not available.
 

ilan

Expert
Licensed User
Longtime User
i guess the part of updating the location will need a native app. what prevents you from making an app that will send the location of the phone to a webserver and you can update it where ever you want. it is not the best solution but from what i see i guess it is the only solution for now
 

Mashiane

Expert
Licensed User
Longtime User
@ilan Definately. There is a portion of the code that does that but not added.

The purported supervisor must know where the employee is by seeing on the map in the office. So servers would come in where what is recorded on the employee device is synced with the server. So options there could be firebase messaging and or even mqtt.
 

alwaysbusy

Expert
Licensed User
Longtime User
So thus we resoluted to record the 5 minute intervals of the location
But is that a timer in the background (which does not work if not active) or do you demand your user to start up his phone every 5 minutes to log the current position? That is not something we can ask from our users. Nor demanding they keep their phone active all the time AND stay on the WebApp (leaving it in the background has the same result).

If they take a 8 hour trip, doing some deliveries on the way but only register start/finish then we can not use the distance they traveled e.g. to pay them per km (that is the kind of solution our users need). They can have traveled 400km, but the app would say e.g. maybe 30km if start and end point of delivery are close.

Your solution is definitely useful to know if they were at a certain place at a certain point of time, but not for tracking.

will need a native app
Exactly. We need also to go into that direction, at the very least some mini app that just does the location call and uploads it via a REST API that then can be called by the PWA. We are also looking into some specialized tracking bluetooth devices that may be useful. Browser just isn't enough. It's a b*tch, I know...

The purported supervisor must know where the employee is by seeing on the map in the office
if the requirement is not realtime, but just at the end or beginning of each trip, that can work. Not if the question is where they are (even) approximately now.

Alwaysbusy
 

Mashiane

Expert
Licensed User
Longtime User
Yes it's a timer without user intervention. The timer starts when a trip starts and stops when the user clicks finish.

Yes, the timer will record where a person is to the local indexed DB. Something like last known position.

I wanted to add and test the trip playback feature based on the recorded 5 minute known position from start to end of the trip.
 

alwaysbusy

Expert
Licensed User
Longtime User
Yes, the timer will record where a person is to the local indexed DB. Something like last known position.
The flow how it works in a Browser:

1. Start trip from Brussels to Paris, put your phone in your pocket and start driving.
2. Travel for a couple of hours: last know position will still be Brussels (as the timer will NOT fire a GeoLocation while in sleep mode: the timer itself may fire but GeoLocation will not give you a new result). The browser buffers all those GeoLocation calls (not executing). If the supervisor looks at his map he will still think the driver hasn't left Brussels and has no idea where he is.
3. Now arriving in Paris, the driver finishes his trip. All hundreds of GeoLocation calls will now be called (giving all the same location in Paris).

That is the whole problem we all have for the moment and why we desperately need the GeoFence API, which will allow executing a GeoLocation while in sleep mode.

Alwaysbusy
 

ilan

Expert
Licensed User
Longtime User
i find it very interesting to build such an app. i have never worked with maps and i would really like to create such an app in the future.
my question to both of you would be, why are you creating such an app based on web? in my opinion the best solution would be a native app (b4a+b4i) that communicates with a webserver (rest api). you can then draw everything on a webpage but the employee app should be native. i don't see any benefits creating an app using JS for mobile.
but maybe i am wrong, am i?
 

ilan

Expert
Licensed User
Longtime User
The flow how it works in a Browser:

1. Start trip from Brussels to Paris, put your phone in your pocket and start driving.
2. Travel for a couple of hours: last know position will still be Brussels (as the timer will NOT fire a GeoLocation while in sleep mode: the timer itself may fire but GeoLocation will not give you a new result). The browser buffers all those GeoLocation calls (not executing). If the supervisor looks at his map he will still think the driver hasn't left Brussels and has no idea where he is.
3. Now arriving in Paris, the driver finishes his trip. All hundreds of GeoLocation calls will now be called (giving all the same location in Paris).

That is the whole problem we all have for the moment and why we desperately need the GeoFence API, which will allow executing a GeoLocation while in sleep mode.

Alwaysbusy
can you track speed while the phone is in sleep mode?
actually this also use the gps so the answer is NO
 

ilan

Expert
Licensed User
Longtime User

ilan

Expert
Licensed User
Longtime User
can you track speed while the phone is in sleep mode?
actually this also use the gps so the answer is NO
The plugin's Philosophy of Operation is to use motion-detection APIs (using accelerometer, gyroscope and magnetometer) to detect when the device is moving and stationary.
so i wasnot to much wrong. you can detect the acclerometer and gyroscope while app is in sleep mode :)

PS: @Mashiane sorry for destroying your thread. maybe we should start a new thread for this discussion?
 

alwaysbusy

Expert
Licensed User
Longtime User
@ilan no, you are 100% right. For the moment it isn't possible. I would love to be able to make a BANano WebApp that could do it, but the JavaScript APIs just aren't ready for it yet. A hybrid B4A/B4I + BANano WebApp is the closest one can get at this time. But like you point out, is it worth it?
can you track speed while the phone is in sleep mode?
No, same problem. Speed is only updated when the GeoLocation API is executed, which isn't in sleep mode.

found this, maybe this could be a solution?
Looked into this too in the past, but not worth to learn it. We do have B4i/B4A 😊
 

Mashiane

Expert
Licensed User
Longtime User
Hey @alwaysbusy, I had not tested it but does the watchPosition also do the same thing when inactive like get Current Position?

@ilan no worries, nothing is destroyed. We share and learn and ask when we don't understand. Thats the beauty about this forum. So nothing is really destroyed and I'm happy that we discussing this.

One of the issues I faced when doing this MVP was time and I already had web templates to do it and also a comfortable ground in BVAD3.

I just love the speed at which one can deliver stuff using b4x tools without a sweat.

So I do my MVPs in web, when a person signs then depending on capabilities use the best approach for the job.
 

alwaysbusy

Expert
Licensed User
Longtime User
does the watchPosition also do the same thing when inactive like get Current Position
Yes unfortunately, it does work the same.

So nothing is really destroyed
Absolutely not! With a slight change of sales pitch, this can be a valuable app. E.g. for a cleaning crew where they have to prove they did go to certain places that day and requires 'checking in and out' this could be ideal. At the end of the day they have send the data over to the main office. There is no tampering of data as you record when and where they were (no 'manual' input).
 
Last edited:

ddefrain

Member
Licensed User
Longtime User
Hi there

Why?

You have employees who travel and claim t&s. The kilometers claimed are in-accurate at worst. You need something that they can use in their mobile devices. They "start" a trip, this records their current location and time. After they finish their trip, they "finish" the trip. This logs their "path", calculating the actual distance travelled.

They should see their location on a map in realtime. At least every 5 minutes, when a work trip is running, their "movement" should be recorded as it times, they might divert using other routes etc. Their "travel log" should be exportable to excel and should be shown in a calendar when choosing a date range. An employee can also cancel a trip.

Development Platform for MVP

BANanoVuetifyAD3 - Version 7.34
GoogleMaps - plot current location in real time & distance travelled calculation using DistanceMatrixService
IndexedDB - storing user profile, trips and movements in real-time
BANano - current position recording with BANanoGeoPosition etc

Preview

View attachment 131311View attachment 131312View attachment 131313View attachment 131314View attachment 131315


View attachment 131316View attachment 131317View attachment 131318View attachment 131319View attachment 131320View attachment 131321


Demo


Source Code

$15

Hello @Mashiane
I've sent You a paypal payment

Best Regards Appreciate You 🙏
Thank's
 
Last edited:
Top