Maps: How to set up Mobile Devices

Created on 3 Sep 2019  Â·  15Comments  Â·  Source: nextcloud/maps

It would be nice to get some help for activating the Mobile Devices feature.
Which andoid apps are possible? The same as here? https://gitlab.com/eneiluj/phonetrack-oc/wikis/userdoc#logging-methods

enhancement 📱 devices good first issue

Most helpful comment

@jakobroehrl Yep we could have a user documentation page on the project wiki.

@jancborchardt Yep that would be nice indeed. I'll probably do it in a few weeks unless there is a PR storm :wink:.

Setting PhoneTrack-Android to log to NC Maps is already implemented and will be possible in next release which, I hope, is coming soon.

All 15 comments

Same as for the tracks feature, we should probably have some sort of emptycontent message when you open the "Devices" navigation section explaining how it works.

@jakobroehrl Yep we could have a user documentation page on the project wiki.

@jancborchardt Yep that would be nice indeed. I'll probably do it in a few weeks unless there is a PR storm :wink:.

Setting PhoneTrack-Android to log to NC Maps is already implemented and will be possible in next release which, I hope, is coming soon.

Still not clear to me how to import a device. Does maps itself has the ability to receive gps data from a smartphone or can it just open gpx / kml files which are stored in nextcloud? Where would I send the gps data to (URL) ?

I'm having the same issues as @dahumph, it would be nice, if there would be any documentation for sending positional data from devices to the maps app. Any news in that regard?

Not yet – what would really help is just a veeery simple 1-2-3 step guide in the readme. :)

Still not clear to me how to import a device. Does maps itself has the ability to receive gps data from a smartphone or can it just open gpx / kml files which are stored in nextcloud? Where would I send the gps data to (URL) ?

Well both the tracks section shows Gpx files which are stored in your nextcloud. The devices section shows dynamically recivied points. For example from phonetrack. Just create a nextcloud maps protocol job.

I'm using some code to send track positions to the NC PhoneTrack app via REST POST calls to https://<myNC>/apps/phonetrack/log/gpslogger/<token>/<id> with a payload of lat={{LAT}}&lon={{LON}}&sat=0&alt=0&acc={{ACC}}&speed=0&bearing=0&timestamp={{TIMESTAMP}}&bat=0

Is there something similar in the Map app?

Just create a nextcloud maps protocol job.

What does this mean :see_no_evil: :sweat_smile:

My phone tracks itself quite fine on the PhoneTrack NC app but I can't see it in Maps. Which is kinda I guess what others point out here too. Is the whole "Your devices" section even working? I assume I somehow have to either link the PhoneTrack and Maps thingies together or push the data into two different places from my device but I seem to be unable to find out how.

Edit: digging further here. Does https://github.com/nextcloud/maps/issues/111#issuecomment-531562275 this comment mean that you can either track your browser or track your device using that one Android app. Is this completely undoable atm with Overland IOS app?

I forgot about this one ;)
FWIW, the url to use to add points is

curl -X POST -u <user>:<password> 'https://<nextcloud_url>/apps/maps/api/1.0/devices?user_agent=<device_name>&lat=<latitude>&lng=<longitude>&accuracy=0&timestamp=<epoch_timestamp>&battery&altitude'

I forgot about this one ;)
FWIW, the url to use to add points is

curl -X POST -u <user>:<password> 'https://<nextcloud_url>/apps/maps/api/1.0/devices?user_agent=<device_name>&lat=<latitude>&lng=<longitude>&accuracy=0&timestamp=<epoch_timestamp>&battery&altitude'

Does this only work with an existing device? I've been trying this, the server just swallows the request and no new information shows up on the maps app.
I can perform a get request against the devices endpoint, which works

Examining this further, only GET requests seem to work.
I added an additional method on DevicesApiController.php , and added a route for it. When the Route is for GET, the test method is called. When the Route is for POST, it is not called.
I have no idea how to debug routing though.

Thanks. I can see it's a post, but I added some debug output to this method: addDevicePoint, and it's never actually called for me.

The routing seems to default to treating it like a GET request:

This command:

curl -X POST -u <username>:<password> 'https://<server-hostname>/nextcloud_test/apps/maps/api/1.0/devices?lat=38.993572&lng=30.124512&user_agent=computer&timestamp=1618689031'

returns:

[{"id":1,"user_agent":"computer1","color":null},{"id":2,"user_agent":"computer","color":null},{"id":3,"user_agent":"Computer (Firefox\/Ubuntu)","color":null}]

And if I look at the server log at the additional debug I added:

The extra debug I added was on the getDevices method:

 public function getDevices($apiversion) {

        error_log("Get Devices called");

Then my apache2 error log contains:

[Tue Apr 20 13:57:22.091883 2021] [php7:notice] [pid 948273] [client xxxxxxx] Get Devices called

The apache2 access log definitely knows that it's a POST request:

xxxxxxxxxxx - USER [20/Apr/2021:14:01:03 +0000] "POST /nextcloud_test/apps/maps/api/1.0/devices?lat=38.993572&lng=30.124512&user_agent=computer&timestamp=1618689031 HTTP/1.1" 200 6560 "-" "curl/7.68.0"

I guess something, somewhere, is transforming your POST into a GET, then maps actually returns the list of devices, indeed.

I guess something, somewhere, is transforming your POST into a GET, then maps actually returns the list of devices, indeed.

Yep, it's pretty weird! I don't have a clue how to track down what's happening there.

Was this page helpful?
0 / 5 - 0 ratings