Sub Listener_NotificationPosted (SBN As StatusBarNotification)
Dim temptitle As String
If Starter.MyLocation.IsInitialized = False Then
StartService(loc)
Else If Starter.MyLocation.Latitude = 0 Then
StartService(loc)
End If
NameGuesses = ""
GeoFenceUp=False
FenceFlag = False
If Starter.MyLocation.Latitude = 0 Then
StartService(loc)
End If
Dim p As Phone
Dim text As String
Dim LastAlertLocFile As RandomAccessFile
Dim LastAlertLoc As String
If p.SdkVersion >= 19 Then
DateTime.DateFormat = "yyyyMMdd"
lasttimestamp = DateTime.Now
Dim jno As JavaObject = SBN.Notification
Dim extras As JavaObject = jno.GetField("extras")
extrastring = extras
extras.RunMethod("size", Null)
temptitle = extras.RunMethod("getString", Array As Object("android.title"))
If SBN.PackageName = "com.capture.app" Then
title = temptitle
End If
If Main.testflag And SBN.PackageName = "com.b4aexample" Then
ToastMessageShow("Notification Captured",False)
If isMessageTest Then
isMessageTest = False
Dim nb As NotificationBuilder
nb.Initialize
nb.Cancel(300)
ToastMessageShow("Capture Working, All Good!", True)
If Main.EventList.IsInitialized Then
Main.EventFile.WriteB4XObject(Main.EventList,0)
Main.EventFile.flush
End If
Else
title = extras.RunMethod("getString", Array As Object("android.title"))
address = extras.RunMethod("getString", Array As Object("android.text"))
currentLoc.Initialize(address,Me,"New_Event")
End If
Main.testflag = False
End If
If SBN.PackageName = "com.capture.app" Then
u.tlog2("L_NP "&SBN.PackageName & " " & extrastring,5)
title = extras.RunMethod("getString", Array As Object("android.title"))
address = extras.RunMethod("getString", Array As Object("android.text"))
currentLoc.Initialize(address,Me,"New_Event")
End If
End If
End Sub