Wicket Posted February 3, 2018 Share Posted February 3, 2018 Hi , I am looking at putting some simple fleet management into one of my projects. I need to be able to record locations of vehicles. I have all of the code to place a marker using longitude and latitude in Google maps, I just need a bit of advice on what device to use to get this information from a vehicle. Has anyone got any experience on using a tracking device in a car, that allows you to connect to a API, or some sort of service so I can at least get the longitude and latitude at that moment in time. I could probably implement what I need using a phone, but that is easy for a user to turn off location access and thus no GPS. I need something like a black box that can be put into the vehicle, and queried to get the current location. Like a tracker device. Any advice or suggestion would be greatly appreciated. Sent from my Pixel using Tapatalk Quote Link to comment Share on other sites More sharing options...
irigsoft Posted February 4, 2018 Share Posted February 4, 2018 HI, I make some tests for this with android device (Tablet). When GPS is ON then unigui application server can get coordinates of device. var id, target, options; function success (pos) { //var crd = pos.coords; //if (target.latitude === crd.latitude && target.longitude === crd.longitude) { // console.log('Congratulations, you reached the target'); //navigator.geolocation.clearWatch(id); // } var out,out2 out = document.getElementById ("out"); out2 = document.getElementById ("TLabel3"); out.innerHTML = "lat:" + pos.coords.latitude + ", long:" + pos.coords.longitude ; out2.innerHTML = "Speed: " + pos.coords.speed + ", Altitude: " + pos.coords.altitude ; } function error(err) { console.warn('ERROR(' + err.code + '): ' + err.message); } target = { latitude : 0, longitude: 0 }; options = { enableHighAccuracy: true, timeout: 0000, maximumAge: 0 }; ID = navigator.geolocation.watchPosition(success, error, options); Quote Link to comment Share on other sites More sharing options...
irigsoft Posted February 4, 2018 Share Posted February 4, 2018 There are GPS devices on the market (black box to mount the car). When the device is running, it sends the coordinates via ComPort or on web server on internet. The device manufacturer typically offers a web server through which data from external software can be read. Quote Link to comment Share on other sites More sharing options...
Wicket Posted February 4, 2018 Author Share Posted February 4, 2018 Thanks irigisoft, this has got me on the right track I think. Sent from my Pixel using Tapatalk Quote Link to comment Share on other sites More sharing options...
irpans Posted March 29, 2021 Share Posted March 29, 2021 On 2/4/2018 at 3:15 PM, irigsoft said: HI, I make some tests for this with android device (Tablet). When GPS is ON then unigui application server can get coordinates of device. var id, target, options; function success (pos) { //var crd = pos.coords; //if (target.latitude === crd.latitude && target.longitude === crd.longitude) { // console.log('Congratulations, you reached the target'); //navigator.geolocation.clearWatch(id); // } var out,out2 out = document.getElementById ("out"); out2 = document.getElementById ("TLabel3"); out.innerHTML = "lat:" + pos.coords.latitude + ", long:" + pos.coords.longitude ; out2.innerHTML = "Speed: " + pos.coords.speed + ", Altitude: " + pos.coords.altitude ; } function error(err) { console.warn('ERROR(' + err.code + '): ' + err.message); } target = { latitude : 0, longitude: 0 }; options = { enableHighAccuracy: true, timeout: 0000, maximumAge: 0 }; ID = navigator.geolocation.watchPosition(success, error, options); hi, how to use this code? Quote Link to comment Share on other sites More sharing options...
irpans Posted March 29, 2021 Share Posted March 29, 2021 On 2/4/2018 at 3:15 PM, irigsoft said: HI, I make some tests for this with android device (Tablet). When GPS is ON then unigui application server can get coordinates of device. var id, target, options; function success (pos) { //var crd = pos.coords; //if (target.latitude === crd.latitude && target.longitude === crd.longitude) { // console.log('Congratulations, you reached the target'); //navigator.geolocation.clearWatch(id); // } var out,out2 out = document.getElementById ("out"); out2 = document.getElementById ("TLabel3"); out.innerHTML = "lat:" + pos.coords.latitude + ", long:" + pos.coords.longitude ; out2.innerHTML = "Speed: " + pos.coords.speed + ", Altitude: " + pos.coords.altitude ; } function error(err) { console.warn('ERROR(' + err.code + '): ' + err.message); } target = { latitude : 0, longitude: 0 }; options = { enableHighAccuracy: true, timeout: 0000, maximumAge: 0 }; ID = navigator.geolocation.watchPosition(success, error, options); Hi, how to use this code?thanks Quote Link to comment Share on other sites More sharing options...
irigsoft Posted March 29, 2021 Share Posted March 29, 2021 2 hours ago, irpans said: Hi, how to use this code?thanks I am sorry, this is old post but I think You can use it with javascript execution from file. there is a javascript execution function. procedure JAVASCRIPT_EXEC (Sender: TObject; fType, Data, DataObjectsList : AnsiString); var I : Integer; DataList : TStringList; sObject : TObject; begin if (Sender <> nil) then begin TRY With TUniControl (Sender) do begin ScreenMask.Message := 'please, wait...'; ScreenMask.WaitData := False;//True; ScreenMask.Enabled := False;//True; end; EXCEPT END; end; IF (Length (Data) > 1) then begin DataList := TStringList.Create; DataList.StrictDelimiter := True; DataList.Delimiter := ';'; DataList.LoadFromFile (Data); Data := TRIM (DataList.Text); DataList.Clear; If Assigned(DataList) then FreeandNil (DataList); end; //TUnibutton (Sender).ClientEvents.ExtEvents.Values ['click'] := 'function click(sender, e, eOpts){' + Data + '}'; //UniSession.JSCode (Data); UniSession.AddJs (Data); //UniSession.JSONDirect (Data); end; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.