B4A Library Notification Builder Library.

PoleStar

Member
Licensed User
Longtime User
Thank you ♥
New version have been successfully tested and works well
 

Alisson

Active Member
Licensed User
Hello!

Barx,
I try use your code, but not execute.
Your apk attached execute in my phone. But the demo not.

My application stopped.
In the log not show errors.

The manifest:


B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="17"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)

SetActivityAttribute(NotePopup, android:parentActivityName, ".NoteParent")
SetActivityAttribute(NotePopup, android:launchMode, "standard")

AddActivityText(NotePopup,<meta-data
        android:name="android.support.PARENT_ACTIVITY"
        android:value=".NoteParent"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

My device:
Galaxy Y
GT-S5360B
Versão Android 2.3.5
Kernel 2.6.35.7

How do I proceed?

Thank you for your work!
 

Attachments

  • NBDemo.zip
    69.2 KB · Views: 303
Last edited:

Dave O

Well-Known Member
Licensed User
Longtime User
I'm creating an "emergency info" app using lock-screen notifications and the NotificationBuilder library. So far, so good.

However, I would like to be able to set the visibility (public/private/secret) of my app's notifications. Apparently there is a SetVisibility method in the Android docs:

https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder.html#setVisibility(int)

I've searched the library docs (and the B4A forums), but I haven't found a way to get at this method. Would it make sense to add it to this library?

Also, I'm not sure if SetVisibility works on a specific notification, all notifications from this app, or all notifications device-wide.

In the meantime, I'll have a go at using JavaObject to call the method, though if someone has already written the code for this, even better.

Cheers!
 
Last edited:

barx

Well-Known Member
Licensed User
Longtime User

What is your code for the notification. without an error, it is difficult to fix. Have you checked the unfiltered logs?
 

barx

Well-Known Member
Licensed User
Longtime User
Hi Dave

I thought that I had already implmented that feature, I will look into it for you. It was a good while ago now at a time when it wasn't clear what the feature was to be used for.
 

barx

Well-Known Member
Licensed User
Longtime User

Attachments

  • NotificationBuilderLibFilesV3-1.zip
    23.2 KB · Views: 296

Chicao99

Member
Licensed User
Longtime User
Hello Barx. When I click on the notification it creates the application again, is it possible to just resume the running one? Below is my notification code:

Sub Activity_Pause (UserClosed As Boolean)

pw.ReleaseKeepAlive

If boolTracking Then

nb.Initialize
nb.SmallIcon = "icon"
nb.Ticker = "Ubico"
nb.setCustomLight(Colors.LightGray,50,50)
nb.DefaultVibrate = False
nb.DefaultSound = False
nb.ContentTitle = "Ubico"
nb.ContentText = "Você tem uma corrida em andamento."
nb.Tag = "notify"
nb.OnGoingEvent=True
nb.setActivity(Main)

nb.Notify (1)

End If


End Sub
 

Alisson

Active Member
Licensed User
Barx, not publish the error, because not have.
The code compiled generate a apk, but not execute.

Thanks
 

barx

Well-Known Member
Licensed User
Longtime User


I believe that would be done within your app code choosing the right place to put code between activity_create and activity_resume. I'm not sure though. If you can find sme java example, I can try advise better.
 

barx

Well-Known Member
Licensed User
Longtime User
Barx, not publish the error, because not have.
The code compiled generate a apk, but not execute.

Thanks
hmmmm, it is difficult for me to try and help then I'm afraid. All I can suggest is to make sure you have the latest android support v4 downloaded and copied into your additional libs folder. make sure you don't have an old version in your b4a libs folder.
 

Peter Yeung

Member
Licensed User
Longtime User
Hello Barx,

Please help, I cannot figure out how to use the Big Text Notification in my Android 5.0 Phone:

B4A code:

Dim nb As NotificationBuilder
Dim nbBigTextStyle As NotificationBigTextStyle

nb.Initialize
nb.SmallIcon = "icon"

nbBigTextStyle.Initialize
nbBigTextStyle.BigContentTitle = "BigTextStyle Example"
nbBigTextStyle.BigText = "This is a large section of text that can only be viewed by expanding the notification. This is usually done with a gesture. On older devices, there is no way to see this in the notification."
nb.SetStyle(nbBigTextStyle)
nb.Notify(1)


Result: No Title and No Text


NB Test: Big Text



NB Test: Result (No Big Text ...)

 

barx

Well-Known Member
Licensed User
Longtime User

Hi Peter

Did you try zooming in or out with 2 fingers, like pinch to zoom on the notification?
 

Peter Yeung

Member
Licensed User
Longtime User
Hi Peter

Did you try zooming in or out with 2 fingers, like pinch to zoom on the notification?

Thanks. It works when I pinch to zoom. Is it possible to do it automatically? I mean the notification message showed in full, like the notifications in ios system...
 

Dave O

Well-Known Member
Licensed User
Longtime User
You should be able to expand a big-style notification by swiping down with 2 fingers, and even 1 finger on some Android versions (e.g. 5+).

For expanding, I don't think there's a way to auto-expand a specific notification. If there's room to expand a notification, the system decides which one. I suspect that playing with the notification's priority will affect this. (For example, I set my notification to -1 because I actually want it collapsed as often as possible.)

Hope this helps!
 

barx

Well-Known Member
Licensed User
Longtime User
As per the Android docs
A notification's big view appears only when the notification is expanded, which happens when the notification is at the top of the notification drawer, or when the user expands the notification with a gesture.

You can try setting the priority to max and this should get you to the top of the list, but if other apps are using the same method, then it will be a case of 'first in, best dressed'
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…