Hello All,
I am trying to set a geofence service but although I can create the geofence, running the example and my App with the same code adapted to it, I can never get the events of Geofence_Enter and Geofence_Exit to run, since the transition values always return -1. I read in the google developers help that it as something to do with the intent, but I cannot figure it out what it is.
Can any google Services Expert help out ?
I am trying to set a geofence service but although I can create the geofence, running the example and my App with the same code adapted to it, I can never get the events of Geofence_Enter and Geofence_Exit to run, since the transition values always return -1. I read in the google developers help that it as something to do with the intent, but I cannot figure it out what it is.
Can any google Services Expert help out ?
B4X:
Sub Service_Start (StartingIntent As Intent) 'StartingIntent is always null
Dim GeofencingEvent As JavaObject
GeofencingEvent.InitializeStatic("com.google.android.gms.location.GeofencingEvent")
GeofencingEvent = GeofencingEvent.RunMethod("fromIntent", Array(StartingIntent))
Dim transition As Int = GeofencingEvent.RunMethod("getGeofenceTransition", Null) ' Always returns -1
Log("GeofenceService Service_Start")
Log("transition:" & transition)
If transition > 0 Then 'Because the transition is always -1 it never evaluates the following code
Dim geofences As List = GeofencingEvent.RunMethod("getTriggeringGeofences", Null)
If geofences.Size > 0 Then
Dim geofence As JavaObject = geofences.Get(0)
Dim id As String = geofence.RunMethod("getRequestId", Null)
If transition = 1 Then
CallSubDelayed2(Starter, "Geofence_Enter", id)
Else If transition = 2 Then
CallSubDelayed2(Starter, "Geofence_Exit", id)
End If
End If
End If
End Sub