Questions tagged [android-geofence]

Represents a geographical region, also known as a geofence.

Geofences can be monitored by geofencer service. And when the user crosses the boundary of a geofence, an alert will be generated.

As currently implemented, in the Google Play Services API, geofences are circular, defined using coordinates (lat, long) and radius.

Documentation

563 questions
6
votes
2 answers

Do background geofences really work on Android 8+?

I have a geofencing app that I am trying to port to get working on Android 8+. I've read the tutorial on the subject, and switched to using compile 'com.google.android.gms:play-services-location:16.0.0'. The geofence enter events never trigger when…
davidgyoung
  • 63,876
  • 14
  • 121
  • 204
6
votes
1 answer

How to do geofencing when app is unresponsive

The new Geofencing API from Google is not triggering any of the events when the app is dead. I tried using PendingIntent.getBroadcast() and PendingIntent.getService() but only being able to get the transition events when the app is opened. I…
6
votes
1 answer

Re-register Geofences only when required

According to the Android geofencing documentation one should re-register the geofences if the following cases occur: The device is rebooted. Solution: The app should store the geofences internally (SharedPreferences) when the geofence is added.…
fernandospr
  • 2,976
  • 2
  • 22
  • 43
6
votes
0 answers

Android - Google Geofence API - Get all the registered geofences

I want to retrieve a list of all the geofences currently active in the system. I have a list view in which there is a slider button to switch on and off each Geofence My problem is if the geofence is not triggered and the duration of expiration has…
6
votes
2 answers

Geofences not triggering (pendingintents and broadcastreceiver)

I've used the Android tutorial with Geofences which, obviously, doesn't work when app is closed. So, after searching around, I've noticed user b-ryce on SO used BroadcastReceiver so geofences get triggered even if app is not active (link for his SO…
gregor
  • 609
  • 1
  • 7
  • 15
6
votes
3 answers

Geofences (Android sample app) java.lang.ClassNotFoundException MainActivity

I have an ASUS Eee Tab (Transformer Prime TF201 Android v4.1.1). I was reading the API on Geofencing and downloaded the sample app here below on to my device => http://developer.android.com/training/location/geofencing.html. But it terminates when i…
6
votes
1 answer

Can I run Android GeoFencing entirely within a background service?

I have an app which needs almost no user interaction, but requires Geofences. Can I run this entirely within a background service? There will be an Activity when the service is first run. This Activity will start a service and register a…
Richard Russell
  • 1,105
  • 1
  • 10
  • 19
5
votes
1 answer

GeofencingEvent.fromIntent(Intent) returns null

I followed this tutorial using Java. As expected the BroadcastReceiver receives an Intent, but the GeofencingEvent fromIntent (Intent intent) method returns NULL. According to the docs for fromIntent: returns - a GeofencingEvent object or null if…
5
votes
1 answer

Geofence Data is empty on transition

I setup a geofence which gets triggered as expected, when the device exits the radius. However the geofencing event is completely empty. override fun onReceive(context: Context, intent: Intent) { val geofencingEvent =…
jpm
  • 3,300
  • 1
  • 19
  • 29
5
votes
2 answers

GEOFENCE_NOT_AVAIBLE (code 1000) while trying to set up geofence

The problem occurs on Android older than Oreo and both Oreo and newer. I can't get geofences working even though following steps are done: Location services are set to High Accuracy Wi-Fi and mobile data are enabled Application is granted…
Domin
  • 1,075
  • 1
  • 11
  • 28
5
votes
0 answers

Enter or Exit trigger not get fired when i am using geofencing

I am using geofencing in my Android app following this link. I am creating and adding geofencing object in my default visible activity and listening to its events with the help IntentService as described in above link. Geofence object successfully…
5
votes
2 answers

Issue Moving from IntentService to JobIntentService for Android O

I am using Intent Service to monitor Geofence transition. For that I am using following call from a Sticky Service. LocationServices.GeofencingApi.addGeofences( mGoogleApiClient, getGeofencingRequest(), …
5
votes
2 answers

Pending Intent not triggering Intent Service in Geofencing

I am using an intent service to create a notification when user enters in the defined geofenced area.The problem is that when I first run the application it works fine and I am getting the pending-intent on my Intent Service, but after some…
Akash Bisariya
  • 3,855
  • 2
  • 30
  • 42
5
votes
2 answers

Geofence works but after a while stops triggering

My Geofence is working at start but then all of a sudden after a day or two stops triggering, is there a problem on Google side here or my code? Upon boot and starting the app I use an IntentService that then registers a Geofence: public class…
5
votes
0 answers

DetectedActivityFence not triggering?

As the title suggest, I'm trying to use the new Awareness API, which works great but the DetectedActivityFence that never gets triggered, no matter what I do, sometimes it gets triggered immediately after it gets registered and that's all. Tried…