Expo Location Geofencing with Task Manager not working (SDK 49)

115 Views Asked by At

I'm using Expo (49) Location Geofencing with Task Manager, and for some reason, the background task doesn't get registered even though it's defined in the global scope (in App.js). Besides geofencing, background notifications, and location services get successfully registered using Task Manager, except for that one.

Calling await TaskManager.isTaskRegisteredAsync(GEOFENCING_TASK) returns false, and I'm not able to debug it and get no errors returned. I'm using physical devices, both iOS and Android, testing it with the expo-dev-client build, and it doesn't work with either of those.

I made sure that I have set background location permissions to 'Always', set all permission messages in ios.infoPlist ( NSLocationAlwaysUsageDescription, NSLocationWhenInUseUsageDescription, NSLocationAlwaysAndWhenInUseUsageDescription ) , set android.permissions to [ "ACCESS_COARSE_LOCATION", "ACCESS_FINE_LOCATION", "ACCESS_BACKGROUND_LOCATION", "FOREGROUND_SERVICE", "RECEIVE_BOOT_COMPLETED" ] set "UIBackgroundModes" to ["location", "fetch", "remote-notification"], set "isAndroidBackgroundLocationEnabled": true, and "isIosBackgroundLocationEnabled": true,

I've provided no more than 20 regions using await startGeofencingAsync(GEOFENCING_TASK, regions) ( passed regions as an array of appropriate objects: {identifier, latitude, longitude, radius, notifyOnEnter, notifyOnExit} ), and I've not set any battery-saving options or some additional settings that could prevent geofencing from working.

I don't know if there's anything else that should be checked upon or set up; the code for initializing geofencing is pretty straightforward, but following everything from the documentation hasn't led me to success.

Also, is there any limitation for the radius (required minimum)? If I start geofencing and I'm already inside a defined region, should an "ON ENTER" event immediately get called?"

0

There are 0 best solutions below