WebDeviceLocation

Hello everybody.

I want to take the data from the location of the device, at the time it is being used. To send it to the database.

Not like UBER does, which sends information to the server at each time separated by seconds. Only when they press a button.

I did not find information about it in the XOJO documentation. But, I think it has changed in the new version 2021.

Does anyone want to share an example?

I appreciate your comments.

Take a look at:

WebLocation

Thanks for your answer.

In the XOJO documentation, there is no example code.
It doesn’t explain much either.

Just mention: “WebLocation works only over HTTPS connections.”

I did a test with the two options it offers, Start and Request. Making sure the page is running over HTTPS.

it is very simple to use, get gps once or permanent.

just drop the WebLocation into a window and add the events via context menu.
i made a project sub folder Certificate with the “windows app name.crt” file
using a build step to copy this beside the executable file.
in build settings you set the ssl port.
you must be sure you made this ip:port accessible from outside / web.
you can use any dyndns provider.

xojo help
https://documentation.xojo.com/topics/application_deployment/web/deployment_details.html#Deploying_with_SSL

for your own use
https://www.selfsignedcertificate.com/

at windows pc

CMD

as Admin

and register your service once
sc create XojoFotoDoku type= own start= auto binpath= "C:\Users\Markus\Documents\MR_Xojo\Foto Doku\Builds - Foto Doku\Windows 64 bit\Foto Doku\Foto Doku.exe"

at windows i set the service to a user account because i want save data there.

at windows pc you have to stop the service to overwrite it with a new executable / build.

as example once to get users location.

Sub Opening() Handles Opening
  System.DebugLog CurrentMethodName 
  
  Me.Request(True)
End Sub

at error you would see that you need https.

Sub Error(error As RuntimeException) Handles Error
  System.DebugLog CurrentMethodName + " " + error.Message
  
  TextLocation.Text = "Error "+ error.ErrorNumber.ToString + " : " + error.Message
End Sub

Sub LocationChanged(latitude As Double, longitude As Double, accuracy As Double, altitude As Double, altitudeAccuracy As Double, course As Double, speed As Double) Handles LocationChanged
  System.DebugLog CurrentMethodName 
  
  here you get the position data
End Sub

my .crt file looks like

-----BEGIN CERTIFICATE-----
MIIC2DCCAcCgAwIBAgIJALoha5fQvq6cMA0GCSqGSIb3DQEBBQUAMBsxGTAXBgNV
...
E7tvwI2D3FyFPn7D
-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAoIGzwbJ8slreZpKzfB86iDIbu4278MXI2sD2LkkV+Ao42eNQ
...
u/2zcxaL61YysORitb4+rVkuVn4nxuSmmeHzzUpI7IC0NvYpdGk=
-----END RSA PRIVATE KEY-----

it is mentioned in Web App Deployment Details

1 Like

Thank you very much, Markus !!!

It worked perfectly, using Windows, MacOS, and XOJO Cloud.

1 Like

Hi,
I’m having the same problem trying to get WebLocation to work. Can’t put the certificate in the same folder during debug since the folder isn’t available until debugging has started. Even after providing the path to the file it doesn’t work. I am opening a local website using the localhost IP and Port 443. Is there a way to check that my project sees the certificate? Using Xojo 2021r3.

Anthony, this may help: