Pulling my hair out here:
Updating NotificationBuilder Lib.
Existing lib code was like this
When I run this version on Oreo (26) I get the error of not having a channel ID
Latest version of support lib deprecates NotificationCompat.Builder(Context) and now uses NotificationCompat.Builder(Context, String) to allow you to pass a channel ID as a string.
So, following the docs I simply change my code to
When I run this in b4a I get the following error
NotificationBuilder.java: Line 91 is the changed line.
Been at it a while now, cannot figure it out.
Using:
b4a - 7.80
support repo - 47
Any Ideas?
Updating NotificationBuilder Lib.
Existing lib code was like this
B4X:
setObject(new NotificationCompat.Builder(ba.context));
Latest version of support lib deprecates NotificationCompat.Builder(Context) and now uses NotificationCompat.Builder(Context, String) to allow you to pass a channel ID as a string.
So, following the docs I simply change my code to
B4X:
private static String CHANNEL_ID = "Default";
...
...
...
setObject(new NotificationCompat.Builder(ba.context, CHANNEL_ID));
When I run this in b4a I get the following error
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
no extras
main_togglenotification_checkedchange (java line: 697)
java.lang.NoSuchMethodError: No direct method <init>(Landroid/content/Context;Ljava/lang/StringV in class Landroid/support/v4/app/NotificationCompat$Builder; or its super classes (declaration of 'android.support.v4.app.NotificationCompat$Builder' appears in /data/app/barxdroid.nbtest-tkciqX_yZSsiVugDO3uc8Q==/base.apk)
at uk.co.barxdroid.notificationbuilder.NotificationBuilder.Initialize(NotificationBuilder.java:91)
at barxdroid.nbtest.main._togglenotification_checkedchange(main.java:697)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.objects.CompoundButtonWrapper$1.onCheckedChanged(CompoundButtonWrapper.java:44)
at android.widget.CompoundButton.setChecked(CompoundButton.java:171)
at android.widget.ToggleButton.setChecked(ToggleButton.java:71)
at android.widget.CompoundButton.toggle(CompoundButton.java:127)
at android.widget.CompoundButton.performClick(CompoundButton.java:132)
at android.view.View$PerformClick.run(View.java:24701)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
main_togglenotification_checkedchange (java line: 697)
java.lang.NoSuchMethodError: No direct method <init>(Landroid/content/Context;Ljava/lang/StringV in class Landroid/support/v4/app/NotificationCompat$Builder; or its super classes (declaration of 'android.support.v4.app.NotificationCompat$Builder' appears in /data/app/barxdroid.nbtest-tkciqX_yZSsiVugDO3uc8Q==/base.apk)
at uk.co.barxdroid.notificationbuilder.NotificationBuilder.Initialize(NotificationBuilder.java:91)
at barxdroid.nbtest.main._togglenotification_checkedchange(main.java:697)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.objects.CompoundButtonWrapper$1.onCheckedChanged(CompoundButtonWrapper.java:44)
at android.widget.CompoundButton.setChecked(CompoundButton.java:171)
at android.widget.ToggleButton.setChecked(ToggleButton.java:71)
at android.widget.CompoundButton.toggle(CompoundButton.java:127)
at android.widget.CompoundButton.performClick(CompoundButton.java:132)
at android.view.View$PerformClick.run(View.java:24701)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
NotificationBuilder.java: Line 91 is the changed line.
Been at it a while now, cannot figure it out.
Using:
b4a - 7.80
support repo - 47
Any Ideas?