Why is the statusCode always successful for removing geofences?

162 Views Asked by At

Strangely, if I run the following code, I get a SUCCESS statusCode in my onRemoveGeofencesByRequestIdsResut() callback.

ArrayList<String> geofencesToRemove = new ArrayList<String>();
                        geofencesToRemove.add("does this actually work?");
                        MainActivity.
                                mLocationClient.
                                removeGeofences(geofencesToRemove, new LocationClient.OnRemoveGeofencesResultListener() {
                                    @Override
                                    public void onRemoveGeofencesByRequestIdsResult(int statusCode, String[] strings) {
                                        if (statusCode == LocationStatusCodes.GEOFENCE_NOT_AVAILABLE) {
                                            Log.i("geofence info", "geofence not available to remove");
                                        } else if (statusCode == LocationStatusCodes.ERROR){
                                            Log.i("geofence info", "error. geofence not removed");
                                        } else if (statusCode == LocationStatusCodes.SUCCESS){
                                            Log.i("geofence info", "geofence successfully removed");
                                        }

                                    }

                                    @Override
                                    public void onRemoveGeofencesByPendingIntentResult(int i, PendingIntent pendingIntent) {

                                    }
                                });

The reason I shouldn't be getting a SUCCESS statusCode is that removeGeofences() accepts a List of geofenceIds (the Ids are strings), and clearly the string "does this actually work?" is not a geofenceId.

So, Does anyone know why I'm getting this unexpected result? Is this a bug with the Geofence API?

0

There are 0 best solutions below