No Geofence alerts being sent

karan kumar6 years ago

Hello:

We are getting Device online/offline and battery low event emails as alerts. Although we created a geofence and the alert was not sent for Entering or Exit from the geofence. We are not using any calendar as we want the alerts to be running 24 hours everyday.

What could be the problem?

Regards

Anton Tananaev6 years ago

Have you enabled notifications for those alert types? Do you see them in events report?

karan kumar6 years ago

Hey Anton:

Yes notifications are enabled for those alert types.

No we do not see the geofence events in event report.

Other alerts for which notifications are enabled do show in events report.

Anton Tananaev6 years ago

Have you linked geofences to your devices?

karan kumar6 years ago

Ahh ok the geofence was not linked. How can we link the geofences to devices using API?

karan kumar6 years ago

We are using API calls from our mobile app to create geofences with deviceid.

Anton Tananaev6 years ago

Use same API calls as web app.

Also, please respect my time and only ask questions after doing own careful research.

karan kumar6 years ago

Hey Anton: We need help in tagging the geofence via the API call. We are able to create the geofence and the API responds with Geofence ID. Post this we make a Devices API PUT call to update the device and tag with Geofence using the Geofence ID. In Response to this we get the Geofence tagged to the device.

Although the moment we make a Get Request for the same device, the geofence tagging is not there in the response. Can you help here please?

Please see the below: -

Response from API after creation of Geofence:

{
    area = "CIRCLE (30.299725 78.021192, 300.000000)";
    attributes =     {
    };
    calendarId = 0;
    description = Ok;
    id = 78;
    name = pk6;
}

Sending Devices API Call to tag the geofence with the device :

http://xxxx.com:8082/api/devices/5
Printing description of dict:

{
    attributes =     {
        "decoder.timezone" = "Asia/Kolkata";
    };
    category = animal;
    contact = "";
    geofenceIds =     (
        78
    );
    groupId = 0;
    id = 5;
    lastUpdate = "2018-07-18T20:23:41.952+0000";
    model = "";
    name = "03";
    positionId = 27489;
    status = unknown;
    uniqueId = xxxxxxxxxx;
}

The response after Devices API PUT request:

{
    attributes =     {
        "decoder.timezone" = "Asia/Kolkata";
    };
    category = animal;
    contact = "";
    disabled = 0;
    geofenceIds =     (
        78
    );
    groupId = 0;
    id = 5;
    lastUpdate = "2018-07-18T20:23:41.952+0000";
    model = "";
    name = "03";
    phone = "";
    positionId = 27489;
    status = unknown;
    uniqueId = xxxxxxxxxx;
}

Now when we make a Devices GET request to device id, the geofence tagging is removed:

(
        {
        attributes =         {
            "decoder.timezone" = "Asia/Kolkata";
        };
        category = animal;
        contact = "";
        disabled = 0;
        geofenceIds =         (
        );
        groupId = 0;
        id = 5;
        lastUpdate = "2018-07-18T20:23:41.952+0000";
        model = "";
        name = "03";
        phone = "";
        positionId = 27489;
        status = offline;
        uniqueId = xxxxxxxxxx;
    },
Anton Tananaev6 years ago

I would recommend you to check what official web app sends. What you call tagging (we call linking) is done differently.

karan kumar6 years ago

Hello Anton:

We downloaded the source code for Traccar Client and Traccar Manager both for Android and IOS. Although we were not able to locate the class and API call made to link the devices with geofences.

Could you be kind enough to help us on the same please?

Regards

Anton Tananaev6 years ago

You have to check web app, not mobile apps.

karan kumar6 years ago

Hello Anton: I am sorry but could you please guide us to the correct query or file in the web app for linking geofence to device?

Anton Tananaev6 years ago

Please put some effort and find it in the code yourself.