Android Question Updating Notification Area

cbanks

Active Member
Licensed User
Longtime User
I want to update a notification every second with new data, but every time it updates it hides the notification and it adds it again (looks like it is blinking). Is there a way to update it instead of the notification disappearing and then appearing again? I just want to change the setinfo and then notify again. I don't want to redraw the notification, just update the text in it.

Dim n As Notification
n.Initialize
n.Icon = "icon"
n.SetInfo("Downloading ", Round((tmp.downloaded*100)/tmp.total) & "%", "")
n.Notify(1)
 
Last edited:

cbanks

Active Member
Licensed User
Longtime User
Does anyone know how to update the notification without refreshing the notification? When I try to update it with the above code, it hides the notification then displays it again. I just want to update the text in it without it redrawing.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I've tried this code:
B4X:
Sub Globals
   Dim n As Notification
End Sub

Sub Activity_Create(FirstTime As Boolean)
   
   n.Initialize
   n.Icon = "icon"
   n.SetInfo("aaa", "bbb", Me)
   n.Notify(1)
End Sub

Sub activity_Click
   n.Vibrate = False
   n.Sound = False
   n.SetInfo(DateTime.Now, DateTime.Now, Me)
   n.Notify(1)
End Sub
The icon is not blinking.
 
Upvote 0

KL7000F

Member
Licensed User
Longtime User
Hello,
I have tested this code and it works according to this method. As soon as I start GPS within the app, the Notification starts to flash. Notification and GPS but do not hang together.

See Video:
Code attached as a zip.

greeting
Andy
 

Attachments

  • testgpsnotification.zip
    9.8 KB · Views: 239
Upvote 1
Top