Hi everyone, I ran into a very strange problem: in a b4a app (default, at the moment it is not possible to switch to b4xpage) I implemented the use of push messages (FirebaseMessaging). The whole project works correctly (including push) but now I am implementing the option to open the app preferences so that the user can change the consent option to receive push notifications. Whether the preferences are opened from the App (intent) or with the app in the background, when I change the preferences the app crashes and generates this error:
I attach a minimal project that worked the first time but now it crashes like in the main project.
I am trying it on pixel8a (Android 14)
B4A v.13.00(64bit)
Java jdk-19.0.2
Android-33
android:minSdkVersion="26" android:targetSdkVersion="33"
Anyone have any idea how to fix this?
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
java.lang.RuntimeException: Unable to create service b4a.example.starter: java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.OutputStream.write(byte[])' on a null object reference
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4925)
at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2407)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8592)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.OutputStream.write(byte[])' on a null object reference
at anywheresoftware.b4a.shell.Shell.virtualAssets(Shell.java:164)
at anywheresoftware.b4a.shell.Shell.start(Shell.java:102)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:105)
at b4a.example.starter.onCreate(starter.java:34)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4912)
... 9 more
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io.OutputStream.write(byte[])' on a null object reference
at anywheresoftware.b4a.shell.ShellConnector.sendControlMessage(ShellConnector.java:61)
at anywheresoftware.b4a.shell.Shell.virtualAssets(Shell.java:124)
... 13 more
I attach a minimal project that worked the first time but now it crashes like in the main project.
I am trying it on pixel8a (Android 14)
B4A v.13.00(64bit)
Java jdk-19.0.2
Android-33
android:minSdkVersion="26" android:targetSdkVersion="33"
Anyone have any idea how to fix this?