B4A Library Notification Builder Library.

barx

Well-Known Member
Licensed User
Longtime User
Well, i'm working on the library a little today as I don't think that the notification returned with getNotification won't have info like tag's and intents. I'm assuming these features will be required? These bits of info are added in the .Notify method. Which, if I understand correct does not get called by your code, but by the service? is this right?
 

shashkiranr

Active Member
Licensed User
Longtime User
Yes Barx,

i am using a service and calling the notification from the service. Have not tried with activity.
 

barx

Well-Known Member
Licensed User
Longtime User
OK, here is another pre-release so to speak. This is because I don't have time right now to do a proper write up for it in the main post

basically there is a new class NotificationCustomLayout so,
B4X:
Dim nLayout as NotificationCustomLayout

This uses xml layout files same as the CustomNotification library. You can use this class to set the elements like text etc

then you call .CustomLayout = nLayout from you NotificationBuilder object

Hope that makes some sense. You will need some knowledge of xml layout files etc.

More good news too which surprised me a little. The expanding style still work with the customlayout.

One little bit of bad news, custom layout are only for API 11+. Big G's restriction, not mine.
NOTE:
If anyone knows how to pass a panel (ViewGroup) into a RemoteViews setup that would mean we can setup a panel for layout in b4a and pass that to library instead of needing xml files, I'm sure I saw it done somewhere in a librarys' code but cannot for the life of me find it.
 
Last edited:

barx

Well-Known Member
Licensed User
Longtime User
First post updated with some V2.3 info. The documentation is in place but no example layout files or a custom layout tutorial yet. Will work on them
 

FabioG

Active Member
Licensed User
Longtime User
I have this problem...
can i fix it ?

Thanks

B4X:
Parsing code.                           0.11
Compiling code.                         0.10
   
ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code.                 0.01
Generating R file.                      0.17
Compiling generated Java code.          2.24
Convert byte code - optimized dex.      Error
A referenced library is missing: android-support-v4
 

yttrium

Active Member
Licensed User
Longtime User
Can you upload an example project that gives a notification like the Gallery app when a screenshot is taken?

Having a little trouble understanding just how this library works.
 

barx

Well-Known Member
Licensed User
Longtime User
OK, i've just done a screenshot to see what your talking about and this effect can be shown with the demo app.

So, if you don't already have the demo app then go to the original post of this thread and either follow the link to play store or download and install from the attached file.

Once you open the app you basically need to disable light, sound and vibration. then scroll down to bottom and select Big Picture as the style and tick 'Add Action'.

Once you then click the button at the very bottom of the app the notification example will be show and the example code will be shown on screen AND printed to the log.

Hope this helps
 

yttrium

Active Member
Licensed User
Longtime User
Very much so, thanks!~
 

SueHale

Member
Licensed User
Longtime User
Hi barx,

Have been using your nice library and all working well, last hurdle is to make use of
nb.customSound anyway try to add my MP3 file I keep getting a Write only error from
the IDE. Seems that missing the correct syntax.

Regards
Sue.
 

barx

Well-Known Member
Licensed User
Longtime User
Hi Sue,

Please try using an '=' instead of ()

example

B4X:
nb.CustomSound("filename")

would become

B4X:
nb.CustomSound = "filename"

Sometimes I get confused

Hopefully that should work, let me know if it does and I will update the documentation.

Thanks
 

SueHale

Member
Licensed User
Longtime User
Hi barx,

Thank-you for such a speedy reply. I tried your suggestion and still no CustomSound.
Have used a Mediaplayer just to quickly get a notification sound as a temporary fix. Sure somebody must have used this feature though.

Regards
Sue.
 

barx

Well-Known Member
Licensed User
Longtime User
Hi barx,

Thank-you for such a speedy reply. I tried your suggestion and still no CustomSound.
Have used a Mediaplayer just to quickly get a notification sound as a temporary fix. Sure somebody must have used this feature though.

Regards
Sue.
Does it now compile?

Can you show us your code for this section?

thanks

p.s. I personally haven't tested custom sounds, it is the only bit I haven't tested. And that is because I had no code or knowledge to get a string path of a custom file.
 

SueHale

Member
Licensed User
Longtime User
Hi barx,

Thank you for your reply. I tried many different methods, including building a string and passing this in. I was attempting to use File.DirAssets to store the MP3 files.

I wonder if looking at the Demo code in post #3 might help to throw any light on things in terms of the Java code calling?

http://www.b4x.com/android/forum/threads/custom-notification-library-barx.16950/

Just to see what changed between both your libraries. Certainly is not a deal breaker as your Lib makes it very easy to create very nice notification messages.

Regards
Sue.





 

barx

Well-Known Member
Licensed User
Longtime User
As far as I am aware, there is no way to have a notification without an icon, the best I can come up with is to use a transparent image as icon, but this has it's own issues...
 

barx

Well-Known Member
Licensed User
Longtime User

I will look into it Sue and replay once fixed, thanks
 

gadgetmonster

Active Member
Licensed User
Longtime User
As far as I am aware, there is no way to have a notification without an icon, the best I can come up with is to use a transparent image as icon, but this has it's own issues...

Thanks for replying. There is a free app called Any.Do in the playstore that has an ongoing notification. Whilst there is an icon in the ongoing notification area, there is no icon on the status bar.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…