Android Question NB6 + SDK >=31

AlpVir

Well-Known Member
Licensed User
Longtime User
I'm using NB6 to display a notification in my app in B4A (ver. 12.0)
The example attached to the post introducing this class works perfectly with SDK=29 and with SDK=30, but not with SDK=31 (nor with SDK=32 or 33)
I read Erel's post recommending (in Nov 2022) to use SDK=31.
See https://www.b4x.com/android/forum/threads/nb6-target-sdk-33.143999/
Now (January 2023) perhaps it would already be useful to adopt SDK 33 but in any case Google imposes the use of SDK 31.
But - as already said - the example doesn't work with SDK=31 !
I specify that in my PC I have (in C:\Android\platforms) :
- android-28
- android-30
- android-33

Here are the first lines of the error

*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
nb6_vv2 (java line: 132)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:132)
at b4a.example3.nb6._vv2(nb6.java:132)
at b4a.example3.main._simple_notification(main.java:467)
at b4a.example3.main._clv_itemclick(main.java:379)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1084)
at anywheresoftware.b4a.keywords.Common.CallSubNew3(Common.java:1047)
at b4a.example3.customlistview$ResumableSub_PanelClickHandler.resume(customlistview.java:805)
at b4a.example3.customlistview._panelclickhandler(customlistview.java:748)
at b4a.example3.customlistview._panel_click(customlistview.java:735)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
at android.view.View.performClick(View.java:7881)
at android.view.View.performClickInternal(View.java:7858)
at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
at android.view.View$PerformClick.run(View.java:30863)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8741)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by: java.lang.IllegalArgumentException: b4a.example3: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
 

agraham

Expert
Licensed User
Longtime User
Upvote 0

AlpVir

Well-Known Member
Licensed User
Longtime User
Thank you. Using library instead of module works with SDK 31 and 32. Not with 33.
That's enough for now.
 
Upvote 0
Top