Android Question Start a service from a notification?

0CrimsonScythe0

Member
Licensed User
Longtime User
I want to start a service when the notification is tapped. I've tried using the notification builder library , but using "addaction2" which supports calling a service , the notification is extended and a "button" appears below the notification which I don't want. Is there any way to start a service without using AddAction2 when the notification is tapped?

B4X:
Sub Service_Start (StartingIntent As Intent)

n1.SmallIcon = "icon"
n1.DefaultLight = True
n1.DefaultVibrate = False
n1.DefaultSound = False
n1.ContentTitle = "xxxxxxxxx"
n1.OnGoingEvent  =True
n1.AddAction2("icon" , "xxxxxxxx" , "" , L)

n1.DefaultVibrate = False

n1.Notify(1)



Service.StartForeground(1 , n1.GetNotification)

End Sub
 

barx

Well-Known Member
Licensed User
Longtime User
You could try

.setIntent and call the intent that will relate to the service you wish to call. Or you could wait a while and I will try to add the functionality to the library direct
 
Upvote 0

0CrimsonScythe0

Member
Licensed User
Longtime User
You could try

.setIntent and call the intent that will relate to the service you wish to call. Or you could wait a while and I will try to add the functionality to the library direct

Thanks for the reply , ok i'll try it out and see how it goes when I get time.
 
Upvote 0
Top