Android Question notification click

ilan

Expert
Licensed User
Longtime User
hi

if i click on the notification and the activity start
how can i know that the app start after i pressed the notification?
and if i have more then one notification how can i know wich one was pressed??

should be something with: noti.SetInfo2
 

ilan

Expert
Licensed User
Longtime User
yes sure....

like this u set it:

B4X:
        Dim noti As Notification
        noti.Initialize
        noti.Light = False
        noti.vibrate = False
        noti.OnGoingEvent = True
        noti.Sound = False
        noti.Icon = "icon"
'        noti.SetInfo("Alarm", "Alarm will start at " & DateTime.Time(alarm), menu)
        noti.SetInfo2("Alarm", "Alarm will start at " & DateTime.Time(alarm),"notialarm", menu)
        noti.Notify(1)

like this u read it:


B4X:
Sub Activity_Resume

Dim inte As Intent
inte = activity.GetStartingIntent
If inte.HasExtra("Notification_Tag") Then
Log(inte.GetExtra("Notification_Tag"))
End If


End Sub

now u can also use this string:


B4X:
Sub Activity_Resume

dim selectednoti as string
Dim inte As Intent
inte = activity.GetStartingIntent
If inte.HasExtra("Notification_Tag") Then
selectednoti = inte.GetExtra("Notification_Tag")
End If

if selectednoti = "notialarm" then STARTALARM
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…