Android Question Persistent nofitications?

wimpie3

Well-Known Member
Licensed User
Longtime User
I'm using the Notification class from https://www.b4x.com/android/forum/threads/nb6-notifications-builder-class-2018.91819/

It seems at least one kind of notification is missing.

I have a Ring video doorbell. When there is someone at my front door, a notification pops up and STAYS open, vibrating constantly. When my phone is locked, the message wakes up my phone.

How can I recreate this with the Notification class? A notification with high importance only shows up for a few seconds (and only vibrates when the phone is locked, not waking up the phone).
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Untested code:
B4X:
Public Sub OnGoing (OnGoingEvent As Boolean) As NB6
   If IsOld Then
       OldNotification.OnGoingEvent = OnGoingEvent
   Else
       NotificationBuilder.RunMethod("setOngoing", Array(OnGoingEvent))
   End If
   Return Me
End Sub

Note that you can also use a foreground service to create a persistent notification.
 
Upvote 0
Top