My service calls notify() below every 30 seconds. When I click on the notification icon, Activity_Resume (below) is successfully called if my application is open. However, if my application is closed, Activity_resume() is not called at all when I click on the notification icon. Then my app just opens, but the screen is blank (the layout is not visible). I use Android 7.
In the Main Activity, I have the following Activity_Resume:
B4X:
Sub notify(notificationText As String)
'ToastMessageShow("Notification for " & notificationText,True )
Notification1.Initialize
Notification1.Icon = "icon" 'use the application icon file for the notification
Notification1.Vibrate = True
Notification1.SetInfo2(DescriptionTitle, notificationText ,notificationText, Main)
Notification1.Sound = True
Notification1.AutoCancel =True
Notification1.Notify(99)
End Sub
In the Main Activity, I have the following Activity_Resume:
B4X:
Sub Activity_Resume
recalcColor
Dim p As Phone
p.SetScreenOrientation(1)
Dim in As Intent
Dim taskRef As String
Dim chainId As Int
in = Activity.GetStartingIntent
If sqlDB.IsInitialized = False Then
sqlDB.Initialize(File.DirInternal,"Chain.db",False)
End If
If in.HasExtra("Notification_Tag") Then
taskRef= in.GetExtra("Notification_Tag")
chainId = taskRef.SubString2(0,taskRef.IndexOf(":"))
txtPlan.Text= getTasks(chainId)
planText=txtPlan.Text
If timeIsCorrect(chainId) Then
ToastMessageShow("You earned 2 extra points by being on time!",True)
timesNotInterrupted=2
Else
timesNotInterrupted=0
End If
recalcColor
sqlDB.Close()
Else
ToastMessageShow("Ingen notification_tag funnet!",False)
End If
End Sub
Last edited: