Geofence Exit events are not coming - need assistance

Prashantha Rao3 years ago

Description: Unable to receive "geofenceExited" event

Version Used : v4.12 (latest version - initially observed in v4.4 and upgraded it, same issue again seen)

I am using below API's to create geofence and attach to the device.

https://tracker.xxxx.com/api/permissions/

Invoking above api 3 times, to link geofenceId, enter & exit notifications (not sure if really required or not), jus followed api calls as observed while enabling it in web.

Below is the error -

2021-05-17 07:51:59  INFO: [490cafc8: osmand > 223.225.56.60] HEX: 485454502f312e3120323030204f4b0d0a636f6e74656e742d6c656e6774683a20300d0a0d0a
2021-05-17 07:51:59  INFO: [490cafc8] id: b306e807808fc74e, time: 2021-05-17 07:51:59, lat: 28.49158, lon: 77.05790, speed: 17.9, course: 214.6
2021-05-17 07:52:00  INFO: [b33a27b9] connected
2021-05-17 07:52:00  INFO: [b33a27b9: osmand < 223.227.20.159] HEX: 474554202f3f69643d383661386465623633366566326564352674696d657374616d703d31363231323337393134266c61743d31322e393739383434266c6f6e3d37372e3535333935352673706565643d352662656172696e673d3130362e3026616c7469747564653d2d36372e38313634333637363735373831322661636375726163793d302e3026626174743d38372e3026617474726962757465733d7b7d20485454502f312e310d0a617574686f72697a6174696f6e3a2045343841354243384237344242354431324432424238433641394132340d0a436f6e74656e742d547970653a206170706c69636174696f6e2f6a736f6e0d0a557365722d4167656e743a20506f73746d616e52756e74696d652f372e32362e380d0a4163636570743a202a2f2a0d0a43616368652d436f6e74726f6c3a206e6f2d63616368650d0a506f73746d616e2d546f6b656e3a2031363966373531632d323438302d343934382d393736382d3733313334633339623231360d0a486f73743a20747261636b65722e636f676f73746563682e636f6d3a353035350d0a4163636570742d456e636f64696e673a20677a69702c206465666c6174652c2062720d0a436f6e6e656374696f6e3a206b6565702d616c6976650d0a436f6e74656e742d4c656e6774683a2035310d0a0d0a7b226c6174223a20227364736164616461222c0a226576656e745f6964223a202267656f66656e63655f656e7465726564227d
2021-05-17 07:52:00  INFO: [b33a27b9: osmand > 223.227.20.159] HEX: 485454502f312e3120323030204f4b0d0a636f6e74656e742d6c656e6774683a20300d0a0d0a
2021-05-17 07:52:00  WARN: [b33a27b9] error - NullPointerException (ExtendedModel:96 < OverspeedEventHandler:137 < BaseEventHandler:29 < ...)
2021-05-17 07:52:00  INFO: [b33a27b9] disconnected

I tried checking source code on finding possible root cause :

ExtendedModel.java

   public double getDouble(String key) {
        if (attributes.containsKey(key)) {
            return ((Number) attributes.get(key)).doubleValue();
        } else {
            return 0.0;
        }
    }

OverspeedEventHandler.java

if (geofence != null) {
                    double currentSpeedLimit = geofence.getDouble(ATTRIBUTE_SPEED_LIMIT);

I tried sending empty attributes ({}) in position update, still same issue seen. Any possible causes?

Prashantha Rao3 years ago

Team,

I realised that if we send attributes with "speedLimit" value, same issue seen. I understand that, above extendedModel tries to refer to "speedLimit" of geofence configuration and generates respective event on position updates. I assume it is a bug that if speedLimit not mentioned in geofence config, it should have been handled accordingly...any thoughts?

Regards,
Prashantha

Prashantha Rao3 years ago

sorry, type : I realised that if we send attributes with "speedLimit" value, same issue not seen.

Anton Tananaev3 years ago

The error indicates that your geofence doesn't have attributes. You have to have at least empty.