Android Question NB6 - Notifications Builder

dibesw

Active Member
Licensed User
Longtime User
I have B4A 12.80 and NB6 works well
There is a way for use BigPicture_Notification with BigText_Notification at the same time?
(in the same notification without having two distinct notifications)

I tried this
BigTextANDBigPicture:
Sub BigPictureANDBigText_Notification
    Dim n As NB6
    smiley = LoadBitmapResize(File.DirAssets, "smiley2.png", 24dip, 24dip, False)
    n.Initialize("default", Application.LabelName, "DEFAULT").SmallIcon(smiley)
    Dim b As Bitmap = LoadBitmap(File.DirInternal, "dentista4.png")
    n.BigPictureStyle(b.Resize(256dip, 256dip, True), b, testotitle, testobody)
    n.Color(0xFF00AEFF)
    
    Dim cs As CSBuilder
    n.BigTextStyle(testotitle, cs.Initialize.BackgroundColor(Colors.Red).Append("summary text").PopAll,testobody)
    'n.Build("title", testobody, "tag", Me).Notify(8)
        
    n.Build("title", "collapsed content", "tag", Main).Notify(7)
End Sub
But not work
 

dibesw

Active Member
Licensed User
Longtime User
Ok.
Now I wish to show big BigPicture with CustomSound at the same time with one notify
and I do...
B4X:
BigPicture_Notification
Notification_WithCustomSound


Sub BigPicture_Notification
    Dim n As NB6
    testotitle="PPPPP"
    testobody="QQQQQ"
    smiley = LoadBitmapResize(File.DirAssets, "smiley2.png", 24dip, 24dip, False)
    n.Initialize("default", Application.LabelName, "DEFAULT").SmallIcon(smiley)
    Dim b As Bitmap = LoadBitmap(File.DirInternal, "dentista4.png")
    n.BigPictureStyle(b.Resize(256dip, 256dip, True), b, testotitle, testobody)
    n.Color(0xFF00AEFF)
    n.Build("title", "collapsed content", "tag", Main).Notify(7)
End Sub
Sub Notification_WithCustomSound
    Dim FileName As String = "tada.mp3"
    File.Copy(File.DirAssets, FileName, provider.SharedFolder, FileName)
    Dim in As Intent
    in.Initialize(in.ACTION_VIEW, "")
    provider.SetFileUriAsIntentData(in, FileName)
    Dim n As NB6
    n.Initialize("custom sound", Application.LabelName, "DEFAULT")
    n.SmallIcon(LoadBitmapResize(File.DirAssets, "smiley.png", 32dip, 32dip, True))
    'disable the default sound
    n.SetDefaults(False, True, True)
    'set custom sound
    n.CustomSound(provider.GetFileUri(FileName))
    'Dim Notification As Notification = n.Build("Notification with custom sound", "...", "", Main)
    Dim Notification As Notification
    Notification.Initialize
    Notification.Icon="icon"
    'Notification.SetInfo("TITLE","BODY",Main)
    Notification.Notify(3)
End Sub

but Notification needs "SetInfo" or "SetInfo2" to work
but I would like to send the text that I chose in BigPicture_Notification
(but so I have two notifications)
How can I get just one notification BigPicture with sound "tada.mp3"?
 
Upvote 0

dibesw

Active Member
Licensed User
Longtime User
No need to do anything special. Simply call n.CustomSound.
Thank you Erel.
Another little question:
what is the different between
AddButtonAction
and
AddRemoteInput ??

both create a button to be managed in service

And is there a limit for lengt of text in BigText?
I have this text that is not all
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I've added this comment to AddRemoteInput for the next update of NB6:

B4X:
'Used for reply fields: <link>more information|https://www.b4x.com/android/forum/threads/notification-with-reply-field.130039/</link>

 
Upvote 0

dibesw

Active Member
Licensed User
Longtime User
Ok thanks

What about max length of BigText?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…