How to set up Mobile Devices
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
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×tamp={{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×tamp=<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×tamp=<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.
https://github.com/nextcloud/maps/blob/59f20942eec30d2d3382d0e8a914e920ccbc374e/appinfo/routes.php#L93
Definitely a POST
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×tamp=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×tamp=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.
I landed on this issue after trying to configure the maps app to track my device location. I think I ended up figuring out a simple way to do it for Android, but there might be better ways. devs, if what I did is wrong, feel free to edit or remove my comment.
Preliminaries:
- Have the Nextcloud files app installed and logged
- Download the PhoneTrack app from F-Droid: https://gitlab.com/eneiluj/phonetrack-android
- Be sure to have the Nextcloud maps app running
How to:
- Open the PhoneTrack app, click on the 3 horizontal bars on the top left corner, go to settings, Account and log in using the Nextcloud files app
- Click on the + icon on botton right, select New Nextcloud Maps log job and create a new job
- Voilà. It should now be working
I landed on this issue after trying to configure the maps app to track my device location. I think I ended up figuring out a simple way to do it for Android, but there might be better ways. devs, if what I did is wrong, feel free to edit or remove my comment.
Preliminaries:
* Have the Nextcloud files app installed and logged * Download the PhoneTrack app from F-Droid: https://gitlab.com/eneiluj/phonetrack-android * Be sure to have the Nextcloud maps app runningHow to:
1. Open the PhoneTrack app, click on the 3 horizontal bars on the top left corner, go to settings, Account and log in using the Nextcloud files app 2. Click on the + icon on botton right, select New Nextcloud Maps log job and create a new job 3. Voilà. It should now be working
I had some troubles using the Nextcloud Maps log job ! I instead installed the Phone Track app and made a Phone Track log job :)
I found this issue as the phonetrack apps stopped working for me.
Add a new point/device by an API call:
curl --header "Content-Type: application/json" \
-u <username>:<password>
--request POST \
--data '{"lat":"0.0","lng":"0.0","user_agent":"test1"}' \
http://nextcloud.example.com/index.php/apps/maps/api/1.0/devices
The field user_agent is the device's name. Also, the fields timestamp, altitude, battery and accuracy can be added.