Private Sub B4XPage_appear
Log("Appear JK")
Dim NewIntent As Intent = B4XPages.GetNativeParent(Me).GetStartingIntent
If PreviousIntent.IsInitialized = False Or PreviousIntent <> NewIntent Then
PreviousIntent = NewIntent
If NewIntent.HasExtra("page") Then
B4XPages.ShowPage(NewIntent.GetExtra("page"))
End If
End If
End Sub
Private Sub Receiver_Receive (FirstTime As Boolean, StartingIntent As Intent)
Dim filename As String = "reminder.txt"
Dim paraMap As Map
Dim bax As clsBasic
bax.Initialize
If File.Exists(File.DirInternal, filename) Then
Dim Link As String = File.ReadString(File.DirInternal, filename)
Log("Received text: " & Link)
' Delete it so it doesn't process twice
File.Delete(File.DirInternal, filename)
paraMap.Initialize
paraMap = bax.GetParametersList(Link)
If paraMap.Size=0 Then
Return
End If
ShowNotification(paraMap)
If StartingIntent.IsInitialized Then
Dim cs As CSBuilder
cs.Initialize.Bold.Size(20).Append($"Action: ${StartingIntent.Action}"$).PopAll
Log(cs)
ToastMessageShow(cs, True)
If B4XPages.IsInitialized And B4XPages.GetManager.IsForeground Then
'B4XPages.ShowPage(StartingIntent.Action)
Else
Log("StartActivity")
Dim in As Intent
in.Initialize(in.ACTION_MAIN, "")
in.SetComponent(Application.PackageName & "/.main")
in.PutExtra("page", StartingIntent.Action)
StartActivity(in)
End If
End If
'
End If
End Sub
Private Sub ShowNotification(ma As Map)
Dim title As String
Dim body As String
Dim ti As String
Dim da As String
Dim id As String
title = "Korgi"
body=ma.Get("title")
ti=ma.Get("time")
da=ma.Get("date")
id=ma.Get("id")
'Kein Datum
If da="null" Or da="" Then
Return
End If
title = da & " " & ti
Dim n As NB6
Dim ic As Bitmap
ic = LoadBitmapResize(File.DirAssets, "icon160.png", 32dip, 32dip, False)
n.Initialize("default", Application.LabelName, "DEFAULT").AutoCancel(True).SmallIcon(ic)
n.Build(title, body, id, Main).Notify(id) 'It will be Main (or any other activity) instead of Me if called from a service.End Sub
'CallSub(B4XPages.MainPage, "nextNotification")
CallSubDelayed(Main, "main_nextNotification")
End Sub