B4A Library Notification Builder Library.

barx

Well-Known Member
Licensed User
Longtime User
OK, there are a couple of issues with your code.

Firstly, you are setting the icon to 'iconnotify' when the relevant icon image does not exist in the /drawable folder. Change this to "icon" or put the relevant icon file in the directory and make it read only.

Secondly, you don't .Notify a notification if it is intended to be used for StartForeground. This does the notification for you. Similarly, you don't build the notification again for StopForeground.

Thirdly, no need to set .AutoCancel = false. You cannot cancel a notificaiton used for foreground service until the foreground status is stopped.

I don't know if you noticed but when your notification isn't configured correctly it doesn't even display your texts.

Make the above amendments and it should work

Hope this helps
 

FabioG

Active Member
Licensed User
Longtime User

Thanks very mutch

solve to copy the icon files to "/drawable" folder

I deleted them by mistake
 

Mrjoey

Active Member
Licensed User
Longtime User
are u sure you are using :
B4X:
notification.bigContentView = expandedView;
if not , can u consider it in the next update please?
 

barx

Well-Known Member
Licensed User
Longtime User
are u sure you are using :
B4X:
notification.bigContentView = expandedView;
if not , can u consider it in the next update please?
Is this a question for me? I don't understand what you are saying?
 

barx

Well-Known Member
Licensed User
Longtime User
Assuming the comment was towards me;
I had never heard of 'BigContentView', and for good reason. It is not included in the NotificationBuilderCompat which this lib exposes.

Nor is it available in the standard NotifcationBuilder class. It is only available if you set it directly to the base Notification class (which nobody really uses now as everything is supposed to be done through the NotificationBuilderCompat to keep it simple). Now whether this is an oversight on Googles side, who knows. Anyways, I cannot really do anything at the moment as I currently 3 days into a 4 day intensive course which includes plenty of learning to carry on with at home between the days (very intense stuff, lol), but, I should hopefully be able to add this function. I will try at the weekend....

There also seems to be a few other bits getting added to Notifications which are for Android v5 (Lollipop) so at some point I need to start looking at those, guess I will give them a few weeks yet though to make sure they have finished updating.
 

barx

Well-Known Member
Licensed User
Longtime User
are u sure you are using :
B4X:
notification.bigContentView = expandedView;
if not , can u consider it in the next update please?

I have made an attempt at adding the .bigContentView (known as BigCustomLayout in the lib). It is an untested feature so I'm just posting it here.

Use it just like CustomLayout.

Please report whether it works or not, thanks
 

Attachments

  • NotificationBuilderLibFilesV3.01.zip
    20.7 KB · Views: 320

KL7000F

Member
Licensed User
Longtime User
Hi,
i try to test NB with a simple programm (Appendix), but i become an error:

B4X:
java.lang.NoClassDefFoundError: android.support.v4.app.NotificationCompat$Builder
    at barxdroid.NotificationBuilder.NotificationBuilder.Initialize(NotificationBuilder.java:50)
    at de.ki.weartest.main._button1_click(main.java:296)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:173)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:161)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:157)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:66)
    at android.view.View.performClick(View.java:4438)
    at android.view.View$PerformClick.run(View.java:18422)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5001)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
    at dalvik.system.NativeStart.main(Native Method)

Latest version of "android-support-v4.jar" and the files from "NotificationBuilderLibFilesV3.01.zip" are in the "Libraries"-Directory. "NBDemo.zip" runs without Error...

Please help!
Andy
 

Attachments

  • test.zip
    7 KB · Views: 219

Mrjoey

Active Member
Licensed User
Longtime User
u need to download the latest version of android-v4 jar , by going to the sdk manager and download it from extras , then copy it to libraries folder.
 

KL7000F

Member
Licensed User
Longtime User
Unfortunately, no success. I have downloaded the latest version (Rev. 21) and copied into the directory. Furthermore, the above error message. As I said in the demo application of "barx" it works if I compile the source code and run on smartphone. My application does not work.
I work with B4A 3.20
 
Last edited:

little3399

Active Member
Licensed User
Longtime User
Hi, barx

I am very interested about the UI , could you tole me , like this UI effect how to achieve? TKS!





 

Attachments

  • upload_2014-10-27_1-19-52.png
    61.6 KB · Views: 189

barx

Well-Known Member
Licensed User
Longtime User

Make sure that there isn't a different version of the support lib in the b4a libs folder. i.e B4AInstallDirectory/Libs. Many people have had issues with this. I even got caught out myself once.
 

little3399

Active Member
Licensed User
Longtime User
Hi, Barx

Tks for your replay , could you share the demo source code for reference , TKS!
 

barx

Well-Known Member
Licensed User
Longtime User
Hi, Barx

Tks for your replay , could you share the demo source code for reference , TKS!
I could share the source project, but to be honest it is rather difficult to follow due to the code for ouputing the code, if that makes sense.

A sample of the layout can be seen here. There really isn't anything special about it...

 

KL7000F

Member
Licensed User
Longtime User
Make sure that there isn't a different version of the support lib in the b4a libs folder. i.e B4AInstallDirectory/Libs. Many people have had issues with this. I even got caught out myself once.
Nope. I kill the old file and reinstall this in sdk-manager and now i copy this file into the Library-Directory (C:\Program Files (x86)\Anywhere Software\Basic4android\Libraries\android-support-v4.jar).
Now, i have reinstall B4A complete. Same error... I do not understand the world anymore...
 

barx

Well-Known Member
Licensed User
Longtime User
What revision of the support file do you have. I also remember having an issue with support file not updating as the SDK manager itself needed updating.

Your looking for revision 20 or above.

I have just checked my SDK manager and there is an update waiting for me. I have rev. 20, rev. 21 is now available. I will download the updated version. It could well be an issue with rev. 21
 

barx

Well-Known Member
Licensed User
Longtime User
Interesting, I will check it out when I get a few mins. Thanks
 

Mrjoey

Active Member
Licensed User
Longtime User
I have made an attempt at adding the .bigContentView (known as BigCustomLayout in the lib). It is an untested feature so I'm just posting it here.

Use it just like CustomLayout.

Please report whether it works or not, thanks
oh , thanks man for ur generosities , appreciate that , tested and worked like a charm anyway , i have a little problem here :
B4X:
cl.setEnableClickEvent("NPrev",Me,"Prev")
cl.setEnableClickEvent("NPlay",Me,"Play")
cl.setEnableClickEvent("NNext",Me,"Next")
"Me" is a service , so when i click on every button nothing happens except the notification window will close , and Service_Start will not be called as expected , any suggestion? and each time calling cl.setimage() schould i initialize it to prevent outofmemory on the bitmap?best regards.
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…