Android Question Bring app back when enter geofence

Hi guys I have an issue so I start google maps and add a geofence then geofence work extreme well and I display a notification when the person goes through that geo fence with google maps running and google maps having focus. I know want to able instead of displaying the google maps bring my app back in focus and minmize google maps in the back ground as well as open another form


Geofence enter:
Private Sub Geofence_Enter (Id As String)
    Log("Geofence_Enter james: " & Id)
    Dim n As Notification
    n.Initialize
    n.Icon = "icon"
    n.SetInfo("Enter: " & Id, "Enter", Main)
    n.Notify(1)
    ToastMessageShow("Enterjames: " & Id, True)
End Sub


instead of Toastmessageshow I want say B4XPages.ShowPages("PODForm") nad bring that form in focus minimizing google maps and opening my page inside my app
 
HI guy just though I would sharte this example got it working thank erel just remember for this example you need to change the gps
geo.Center.Initialize2(-29.814433207125315, 30.90207661547709) 'change location! to your location to test it

Geofence app to popup over:
    rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
    Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
    If Result Then
        Dim p As Phone
        If p.SdkVersion >= 29 Then
            rp.CheckAndRequest("android.permission.ACCESS_BACKGROUND_LOCATION")
            Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
        End If
        If Result Then
            Dim geo As Geofence
            geo.Initialize
            geo.Id = "Test2"
            
            '-29.814433207125315, 30.90207661547709
            geo.Center.Initialize2(-29.814433207125315, 30.90207661547709) 'change location!
            geo.RadiusMeters = 600
            geo.ExpirationMs = DateTime.TicksPerDay 'expire after one day
            CallSubDelayed3(GeofenceReceiver, "AddGeofence", Me, geo)
            Wait For Geofence_Added (Success As Boolean)
            Log("Geofence added: " & Success)
        End If
    End If
 
Upvote 0
guy I dunno what I doing wrong in the above example it works 100% first time when I try implement this in my application its not working at all bear in mind I am using a fused location provider but I even disabled the service and still no joy any assistance would be great. In my main app I using a few intent method 1 for google map and and other to call a speed point device could these in any change message around with it
 
Upvote 0
Top