Android Question LOOKING FOR ADVICE - VEHICLE TRACKING

Intelemarketing

Active Member
Licensed User
Longtime User
I was looking for some advice on developing an app which allows a company to track their vehicles, using Google Maps.
I understand from the Google maps examples how to present a map with a pointer showing a particular location.
The issue is that there may be 1, 10, 100, or even 1000 vehicles that need to be tracked, which presents the problem of how the vehicle's location is to be reported back to base.
A permanent connection back to base from each vehicle/phone is out of the question as there could be too many connections running at the same time, I would think.
I was looking at alternatives - eg, Using FTP to send the location points from each vehicle every few minutes. (Then be monitored by an app at the base which can process each vehicle's location). The downside of this approach is that literally thousands of FTP uploads/downloads will take place every day.

That's the best I can come up with - Just wondering if there may be a better way to do this.

Thanks
 

TILogistic

Expert
Licensed User
Longtime User
The phone would upload the data only if the GPS Co-Ordinates change significantly.
I have found that repeatedly transmitting the co-ordinates from a stationary location can fluctuate slightly.

This can be avoided in 2 ways:

1.- Setting the time and distance that the location must report:

Using FusedLocationProvider:
B4X:
LocationRequest1.SetInterval (B4XPages.MainPage.GpsTimeInterval) 'milliseconds
LocationRequest1.SetSmallestDisplacement (B4XPages.MainPage.GpsMeterInterval) 'Meter

or limiting by distance.

Sample:
B4X:
    Dim VisionRadius As Int = 500 'meters
    If LastLocation.DistanceTo(CurrentLocation) > VisionRadius And CurrentLocation.Speed > 0 Then
        UpdateLocationServer()
    End If
 
Last edited:
Upvote 0

Intelemarketing

Active Member
Licensed User
Longtime User
To view your mobile phones on the web, You can develop a simple PHP APP with Google Maps showing your mobile phones.

I always recommend:


For its wide range of Plug-in and maps (OpenStreet, googlemap, BingMap, Mapbox, etc)
Thank you so much for your pointers and suggestions - So as I go forward now "My Journey to the Centre of the Earth", I can rest assured that the directions given will keep me on the right path. Again - I am overwhelmed by the substantial and depth of experience you guys have with B4X which, as a platform, deserves the brilliant support of followers like yourselves.

It is such an enormous credit to Erel that the platform is going ahead in leaps and bounds with a stability and reliability far beyond what the industry normally delivers - we live in a highly complex industry which is difficult to maintain perfectly, yet Erel continues to deliver 100% gold! Thank you Erel ! (Do you ever sleep ?)
 
Upvote 0

amorosik

Expert
Licensed User
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
How to use Leaflet within B4J code ?
ALWAYS create your own thread for YOUR questions Posting another question in an old thread is a mistake. Especially on Page 3 of that thread

Away from that: This is the B4A Forum!!
 
Upvote 0

Intelemarketing

Active Member
Licensed User
Longtime User
If you use a FTP you can have a strict limit on most server, expecially on shared platforms. Only a few sessions at a time.
Use a PHP page on web server.
Yes - I have had the experience that a host will shut down your site if you execute too many FTP calls in a short time. I am no PHP expert but thank you for the suggestion
 
Upvote 0

tigrot

Well-Known Member
Licensed User
Longtime User
PHP:
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$sql = "UPDATE MyGuests SET lastname='Doe' WHERE id=2";

if ($conn->query($sql) === TRUE) {
    echo "Record updated successfully";
} else {
    echo "Error updating record: " . $conn->error;
}

$conn->close();
?>
 
Upvote 0

labcold

Member
Licensed User
Longtime User
I was looking for some advice on developing an app which allows a company to track their vehicles, using Google Maps.
I understand from the Google maps examples how to present a map with a pointer showing a particular location.
The issue is that there may be 1, 10, 100, or even 1000 vehicles that need to be tracked, which presents the problem of how the vehicle's location is to be reported back to base.
A permanent connection back to base from each vehicle/phone is out of the question as there could be too many connections running at the same time, I would think.
I was looking at alternatives - eg, Using FTP to send the location points from each vehicle every few minutes. (Then be monitored by an app at the base which can process each vehicle's location). The downside of this approach is that literally thousands of FTP uploads/downloads will take place every day.

That's the best I can come up with - Just wondering if there may be a better way to do this.

Thanks
We run personal trackers for security purposes based on Android Smart watches and we run 1000's across continental Australia without any problem. We use two methods MQTT via wifi or cell data as appropriate and SMS otherwise, to get maximum coverage even in the poorest signal areas. All is reported and displayed using MapBox actually as I prefer the API to Google maps its lighter for large numbers. Tracking is done every 5 - 15 mins under normal use and then 1 per minute in the event of an alert for the duration. We also record and can stream audio as well as manage VOLTE calls from the consoles or other phones. All devices operate collaboratively so any user can choose to receive alerts from others if they are able to render assistance due to proximity or role. All devices operate in a hierarchical group structure allowing separate reporting paths for different groups of users.

We run this 24*7 for a number of different companies and we have various different types of device to allow for different use such as lone working or security purposes. All the targets are built in B4A and the servers all run B4J which provides the internal operational transactions and database interfaces as well as the web and SMS interfaces. We can run on fixed hardware or in Cloud VM as required by the customers. We also have desktop stand alone and pc based connections to allow all personnel to be interactive.

Biggest issue is keeping the cell data connections operable - wifi and SMS are trivial but even 4G doesnt really provide for a quality regular update service and you have to work quite hard to manage the connections.

Anyway I thought I would share this to add into your mixing pot for your project :D - Good luck :D

dvcc.jpg
 
Upvote 0

Intelemarketing

Active Member
Licensed User
Longtime User
PHP:
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$sql = "UPDATE MyGuests SET lastname='Doe' WHERE id=2";

if ($conn->query($sql) === TRUE) {
    echo "Record updated successfully";
} else {
    echo "Error updating record: " . $conn->error;
}

$conn->close();
?>
Thanks so much for your interest and generosity - Greatly appreciated ! I am so humbled by the number of people on the forum who have been so helpful - Thanks so much to you all !
 
Upvote 0

amorosik

Expert
Licensed User
We run personal trackers for security purposes based on Android Smart watches and we run 1000's across continental Australia without any problem. We use two methods MQTT via wifi or cell data as appropriate and SMS otherwise, to get maximum coverage even in the poorest signal areas. All is reported and displayed using MapBox actually as I prefer the API to Google maps its lighter for large numbers. Tracking is done every 5 - 15 mins under normal use and then 1 per minute in the event of an alert for the duration. We also record and can stream audio as well as manage VOLTE calls from the consoles or other phones. All devices operate collaboratively so any user can choose to receive alerts from others if they are able to render assistance due to proximity or role. All devices operate in a hierarchical group structure allowing separate reporting paths for different groups of users.

We run this 24*7 for a number of different companies and we have various different types of device to allow for different use such as lone working or security purposes. All the targets are built in B4A and the servers all run B4J which provides the internal operational transactions and database interfaces as well as the web and SMS interfaces. We can run on fixed hardware or in Cloud VM as required by the customers. We also have desktop stand alone and pc based connections to allow all personnel to be interactive.

Biggest issue is keeping the cell data connections operable - wifi and SMS are trivial but even 4G doesnt really provide for a quality regular update service and you have to work quite hard to manage the connections.

Anyway I thought I would share this to add into your mixing pot for your project :D - Good luck :D

View attachment 119313

Which device for tracking position?
Classic smartphone o specific tracking device?
 
Upvote 0

Intelemarketing

Active Member
Licensed User
Longtime User
Which device for tracking position?
Classic smartphone o specific tracking device?
We want to use a Classic SmartPhone for tracking GPS locations. I have had some success by creating an FTP connection and sending back a small document with PhoneNo, GPS Co-Ordinates, and DateTime Stamp. Logically it seems to work, until the phone goes to sleep and the app seems to stop. I have created my own FTP Site using FileZilla Server which is interesting, to say the least. (Had a few attacks from Ukraine and China trying to log into my FTP Server, only a day or two after I got it working - Is this normal ? ). But I continue to work through these little challenges. Thanks for your comprehensive reply !
 
Upvote 0
Top