Problems when assign geofence using traccar Post Device API

Hercules4 years ago

Hello,

I'm trying to assign geofences at the same time i'm creating a device using the Post API. The device creates just fine, but no matter what i do the geofences do not work. Here is an example of the Json code i used:

{
"id":0,
"name": "name",
"uniqueId": "21171",
"status": "status",
"disabled": false,
"lastUpdate": "2019-08-24T14:15:22Z",
"positionId": 0,
"groupId": 0,
"phone": "phone",
"model": "model",
"contact": "contact",
"category": "category",
"geofenceIds": [
25,26,27,28,29,30,31
],
"attributes": { }
}

And here is what i got in return.

{
    "id": 90,
    "attributes": {},
    "groupId": 0,
    "name": "name",
    "uniqueId": "21171",
    "status": "status",
    "lastUpdate": "2019-08-24T14:15:22.000+0000",
    "positionId": 0,
    "geofenceIds": [],
    "phone": "phone",
    "model": "model",
    "contact": "contact",
    "category": "category",
    "disabled": false
}

I was debuging the traccar code and realized it can receive all the values, but it appears that somewhere after passes GeofenceManager class the devices no longer have any geofence associated with it.

I'm struggling with this problem for weeks, so any amount of help will be greatly appreciated.

Best Reguards,
Hercules Gimenes

Anton Tananaev4 years ago

Well, you are using wrong API. List of geofences in the devices modes is not something you can set. Use proper linking API.