Hi,
I am on the process of changing my app's FCM Notifications from NotificationBuilder to the new NB6 from B4A
To inform my app user regarding the release of a new version, I used to send notification to the user. When the user clicks on the notification, the user will be taken to my App's page on the Google PlayStore.
The code that I used with the BarX's NotificationBuilder library was as follows
The equivalent code that I tried to get the same done using NB6 is as follows. Unfortunately it is not working.
When I receive an FCM message on the device, on the LOG I see the following error message
After accept
** Receiver (firebasemessaging) OnReceive **
** Service (firebasemessaging) Start **
nb6_createintent (java line: 262)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at anywheresoftware.b4j.object.JavaObject.InitializeNewInstance(JavaObject.java:90)
at com.myapp.publicapp.nb6._createintent(nb6.java:262)
at com.myapp.publicapp.nb6._build(nb6.java:165)
at com.myapp.publicapp.fcmnotificationsnew._processnotifications(fcmnotificationsnew.java:536)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
at anywheresoftware.b4a.keywords.Common$11.run(Common.java:1154)
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:6940)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Class.getName()' on a null object reference
at android.content.ComponentName.<init>(ComponentName.java:131)
Any idea what could be wrong here. The message is reaching the device, but unable to dismiss the message by swiping. At the same time, see the above error in the LOG.
I would also like to know the equivalent of BarX's following code
What the above code does is as follows. Once the user clicks on the Notification the user is taken to the Activity named "Offers". Once the user press the back key from the "Offers" page, the user will be taken to the "HomePage" activity ie the Parent Activity.
Any help will be appreciated
I am on the process of changing my app's FCM Notifications from NotificationBuilder to the new NB6 from B4A
To inform my app user regarding the release of a new version, I used to send notification to the user. When the user clicks on the notification, the user will be taken to my App's page on the Google PlayStore.
The code that I used with the BarX's NotificationBuilder library was as follows
B4X:
Dim market As Intent, uri As String
uri="market://details?id=com.myapp.publicapp"
market.Initialize(market.ACTION_VIEW,uri)
nb.setActivity(market)
nb.setParentActivity(HomePage)
nb.Notify(nNotificationCount)
The equivalent code that I tried to get the same done using NB6 is as follows. Unfortunately it is not working.
B4X:
Dim market As Intent, uri As String
uri="market://details?id=com.myapp.publicapp"
market.Initialize(market.ACTION_VIEW,uri)
nb.Build(cSubject,cMsg,"",market).Notify(nNotificationCount)
When I receive an FCM message on the device, on the LOG I see the following error message
After accept
** Receiver (firebasemessaging) OnReceive **
** Service (firebasemessaging) Start **
nb6_createintent (java line: 262)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at anywheresoftware.b4j.object.JavaObject.InitializeNewInstance(JavaObject.java:90)
at com.myapp.publicapp.nb6._createintent(nb6.java:262)
at com.myapp.publicapp.nb6._build(nb6.java:165)
at com.myapp.publicapp.fcmnotificationsnew._processnotifications(fcmnotificationsnew.java:536)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
at anywheresoftware.b4a.keywords.Common$11.run(Common.java:1154)
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:6940)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Class.getName()' on a null object reference
at android.content.ComponentName.<init>(ComponentName.java:131)
Any idea what could be wrong here. The message is reaching the device, but unable to dismiss the message by swiping. At the same time, see the above error in the LOG.
I would also like to know the equivalent of BarX's following code
B4X:
nb.setActivity(Offers)
nb.setParentActivity(HomePage)
What the above code does is as follows. Once the user clicks on the Notification the user is taken to the Activity named "Offers". Once the user press the back key from the "Offers" page, the user will be taken to the "HomePage" activity ie the Parent Activity.
Any help will be appreciated
Last edited: