Set a minimum radius of 100 meters (or even better - recommended 150 m) to get the best results from your geofences. It helps account for the location accuracy of typical Wi-Fi networks, and also helps reduce device power consumption.
Possible reasons for alert failures
- Accurate location is not available inside your geofence or your geofence is too small.
- On most devices, the geofence service uses only the network location for geofence triggering. The service uses this approach because network location consumes much less power, takes less time to get discrete locations, and most importantly, is available indoors.
- Wi-Fi is turned off on the device.
- Active Wi-Fi can significantly improve location accuracy. If Wi-Fi is turned off, your application might never get geofence alerts depending on several settings. These include: the radius of the geofence, the device model, or the Android version. From Android 4.3 (API level 18) on, there is the capability of “Wi-Fi scan only mode” which allows users to disable Wi-Fi while still getting a good network location.
- It is good practice to prompt the user and provide a shortcut for the user to enable Wi-Fi or Wi-Fi scan only mode if both of them are disabled. Use SettingsClient to ensure that the system settings of the device are properly configured for optimal location detection.
If your app targets Android 10 (API level 29) or higher, you cannot call WifiManager.setEnabled (deprecated from API 28) directly unless your app is a system app or a device policy controller (DPC). Instead, use a settings panel.
- There is no reliable network connectivity inside your geofence.
- If there is no reliable data connection, alerts might not be generated. This is because the geofence service depends on the network location provider which in turn requires a data connection.
- Alerts can be late.
- The geofence service does not continuously query for location, so expect some latency when receiving alerts. Usually, the latency is less than 2 minutes, even less when the device has been moving. If Background Location Limits are in effect, the latency is about 2–3 minutes on average. If the device has been stationary for a significant period, the latency may increase to up to 6 minutes.
To troubleshoot the geofence entrance event, see this Android guide.
If geofences are not triggered when the device enters a geofence (the GEOFENCE_TRANSITION_ENTER alert is not triggered), ensure that your geofences are registered properly as described in the above guide.
Location settings for Android 9.0+
Change location settings.
- Open the Settings app on your device.
- Tap Security & Location > Location. If you have a work profile, tap Advanced.
- Select Turn Location on or off: Tap Location.
- Scan for nearby networks: Tap Advanced > Scanning . Turn on Wi-Fi scanning and Bluetooth scanning.
- Turn emergency location service on or off: Tap Advanced > Google Emergency Location Service . Turn Emergency Location Service on.
Location settings for Android 4.4 - 8.1
You can choose your location mode based on accuracy, speed, and battery use.
- Open your phone's Settings app.
- Tap Security & Location > Location. If Security & Location is not available, tap Location.
- Tap Mode.
- High accuracy: Use GPS, Wi-Fi, mobile networks, and sensors to get the most accurate location. Use Google Location Services to help estimate your phone's location faster and more accurately.
- Battery saving: Use sources that use less battery, like Wi-Fi and mobile networks. Use Google Location Services to help estimate your phone's location faster and more accurately.
- Device only: Use the only GPS. Don’t use Google Location Services to provide location information. This can estimate your phone's location more slowly and use more battery.