I IdasI4A Active Member Licensed User Longtime User Aug 30, 2022 #1 I am using NB6 to display notifications. If the app is in the foreground when the notification arrives and I click on it, it takes me to the indicated page, but if the app is in the background when I click on the notification, it disappears and does not take me to the indicated page. How can I make it so that when I click on the notification it shows me the app, whether it is active or not? Thnks
I am using NB6 to display notifications. If the app is in the foreground when the notification arrives and I click on it, it takes me to the indicated page, but if the app is in the background when I click on the notification, it disappears and does not take me to the indicated page. How can I make it so that when I click on the notification it shows me the app, whether it is active or not? Thnks
Jeffrey Cameron Well-Known Member Licensed User Longtime User Aug 30, 2022 #2 Does this post help? Click on notification should only bring my app to foreground (to screen) - SOLVED! Hi! The subject of my post explains what I need: I use the simple notification class to create a simple notification. Dim n As Notification If n.IsInitialized == False Then n.Initialize n.Sound = False n.Insistent = False n.Vibrate = False n.Icon = "icon" n.Light =... www.b4x.com Upvote 0
Does this post help? Click on notification should only bring my app to foreground (to screen) - SOLVED! Hi! The subject of my post explains what I need: I use the simple notification class to create a simple notification. Dim n As Notification If n.IsInitialized == False Then n.Initialize n.Sound = False n.Insistent = False n.Vibrate = False n.Icon = "icon" n.Light =... www.b4x.com
I IdasI4A Active Member Licensed User Longtime User Aug 31, 2022 #3 I can't get it. I use B4XPages and what I do is: When I make the notification B4X: Copy Dim N As NB6 N.Initialize("default", Application.LabelName,"DEFAULT") N.AutoCancel(True) N.SmallIcon(LoadBitmap(File.DirAssets,"icon.png")) N.OldNotificationIcon("icon") N.OnGoing(True) N.Build(Texto,Titulo,"miTag" & Valor, Main ).Notify(1) I have added in Main B4X: Copy Sub Activity_Resume B4XPages.Delegate.Activity_Resume B4XPages.MainPage.ActivityResume ' <-- This line End Sub And in B4MainPage B4X: Copy Public Sub ActivityResume Dim in As Intent = B4XPages.GetNativeParent(Me).GetStartingIntent If in.IsInitialized And in <> LastIntent Then LastIntent = in If in.HasExtra("Notification_Tag") Then Dim Tag As String = in.GetExtra("Notification_Tag") Dim Linea As Int B4XPages.ShowPage("Tramites") pgTramites.VerTramite(Tag) End If End If End Sub If the app is in the foreground when I click on the notification it shows me the page "Tramites", if it is in the background it does nothing. Upvote 0
I can't get it. I use B4XPages and what I do is: When I make the notification B4X: Copy Dim N As NB6 N.Initialize("default", Application.LabelName,"DEFAULT") N.AutoCancel(True) N.SmallIcon(LoadBitmap(File.DirAssets,"icon.png")) N.OldNotificationIcon("icon") N.OnGoing(True) N.Build(Texto,Titulo,"miTag" & Valor, Main ).Notify(1) I have added in Main B4X: Copy Sub Activity_Resume B4XPages.Delegate.Activity_Resume B4XPages.MainPage.ActivityResume ' <-- This line End Sub And in B4MainPage B4X: Copy Public Sub ActivityResume Dim in As Intent = B4XPages.GetNativeParent(Me).GetStartingIntent If in.IsInitialized And in <> LastIntent Then LastIntent = in If in.HasExtra("Notification_Tag") Then Dim Tag As String = in.GetExtra("Notification_Tag") Dim Linea As Int B4XPages.ShowPage("Tramites") pgTramites.VerTramite(Tag) End If End If End Sub If the app is in the foreground when I click on the notification it shows me the page "Tramites", if it is in the background it does nothing.
I IdasI4A Active Member Licensed User Longtime User Sep 2, 2022 #4 I generated the notification when I got a message from FireBase, the problem was in the message that already included a notification. If the message is: JSON: Copy notification { title=titulo, body=body of notification, } data { campo1=valor1, campo2=valor2, } When I receive the message with the app in the background it puts the message notification and when I click on it the app doesn't know about it. But if the message is: JSON: Copy data { campo1=valor1, campo2=valor2, } When I receive the message to the app creates the notification, when I click on the notification the app knows tanato this in foreground or background. I comment it in case someone can help you. Thanks Upvote 0
I generated the notification when I got a message from FireBase, the problem was in the message that already included a notification. If the message is: JSON: Copy notification { title=titulo, body=body of notification, } data { campo1=valor1, campo2=valor2, } When I receive the message with the app in the background it puts the message notification and when I click on it the app doesn't know about it. But if the message is: JSON: Copy data { campo1=valor1, campo2=valor2, } When I receive the message to the app creates the notification, when I click on the notification the app knows tanato this in foreground or background. I comment it in case someone can help you. Thanks