Notification event problem

Der Mond

Member
Licensed User
Longtime User
Hi,
I created a Service that should display a notification when the Counter = 10.
When I click on the notification the program should run the code "Notification_Click".
Unfortunately, when the counter reaches 10 the program executes immediately "Notification_Click"
without waiting my clicking the icon in the notification.
Where am I wrong?

Thanks a lot
Vincenzo

B4X:
Sub Process_Globals
   Dim Counter As Int 
   Dim n As Notification
 
End Sub

Sub Service_Create

   n.Initialize
   n.Icon = "my_icon"
   n.Vibrate = False
   n.Sound = False
   
   Counter=0         

End Sub

Sub Service_Start
  Counter=Counter+1
  If Counter = 10 Then
   n.SetInfo("Title", "Counter = 10", Notification_Click)
   n.Notify(1)
  End If
  StartServiceAt("", DateTime.Now + 1 * DateTime.TicksPerSecond, True)
End Sub

Sub Notification_Click
   ...
   ...
End Sub
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…