Geofencing is an Android feature that allows your app to be notified when the user enters or exits a monitored region. The nice thing about this feature is that your app doesn't need to run for monitoring to work. It will be started automatically when needed. The GeofenceService uses...
www.b4x.com
Does not show any Map!
It is an example on how to setup a GeoFence.
An event is raised if your device position is inside a Fence.
Even if you leave a Fence a event is raised.
If you want to show a Map then you should use this tutorial:
Installation instructions: - Register your app in Google developer console: https://console.developers.google.com You need to enable Google Maps Android API. Then click on Credentials -> Create Credentials -> API Key -> Android Key. You should get a key that looks like...
What have you installed?
If you have installed the geofence example, you have to setup the central point and the radius.
If you enter in the radius of the circle then you will see the notification and the toastmessage "Enter 1"
If you go out, you will see "Exit 1".
You have to test it outside to get gps cover, and walk to exit the radius...
B4X:
Public Sub Geofence_Enter (Id As String)
Dim n As Notification
n.Initialize
n.Icon = "icon"
n.SetInfo("Enter: " & Id, "Enter", Main)
n.Notify(1)
ToastMessageShow("Enter: " & Id, True)
End Sub
Public Sub Geofence_Exit (Id As String)
Log("Exit: " & Id)
ToastMessageShow("Exit: " & Id, True)
Dim n As Notification
n.Initialize
n.Icon = "icon"
n.SetInfo("Exit: " & Id, "Exit", Main)
n.Notify(2)
End Sub