Android Question [resolved] close the notifications drawer

Duque

Active Member
Licensed User
Longtime User
How to fold the notification bar when you click on an action button.

example:
clic.jpg


I intend to click on call and bring the screen to the front to make the call but it is hidden, as shown here:
oculto.jpg


I use the of erel class for this https://www.b4x.com/android/forum/threads/nb6-notifications-builder-class-2018.91819/#content

I leave a small project for which I want to help.
Thank you
 

Attachments

  • exampleNotifi.zip
    14.3 KB · Views: 242

Duque

Active Member
Licensed User
Longtime User
See the notification with actions example.


The example gives the same result.
When clicking on the buttons the notification bar is still in deployment, the idea is that by clicking on the action buttons the notification bar returns to its normal state.

B4X:
Sub Notification_WithActions
    Dim n As NB6
    n.Initialize("default", Application.LabelName, "DEFAULT").SmallIcon(smiley)
    n.AddButtonAction(smiley, "Action 1", MyService, "action 1")
    Dim cs As CSBuilder
    n.AddButtonAction(Null, cs.Initialize.Color(Colors.Red).Bold.Append("Action 2").PopAll, MyService, "action 2")
    n.DeleteAction(MyService, "delete action")
    n.Build("Actions", "Actions", "tag", Me).Notify(1)
End Sub
 
Upvote 0

Duque

Active Member
Licensed User
Longtime User
that solves it thank you very much

B4X:
Dim intent As Intent
intent.Initialize("android.intent.action.CLOSE_SYSTEM_DIALOGS", "") 'close the notifications drawer
Dim p As Phone
p.SendBroadcastIntent(intent)
 
Upvote 0
Top