You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi everyone.
I'm trying to figure out how to use the Capacitor Android bridge in a class, not in a plugin. Specifically, I've created a native NotificationServiceExtension class per OneSignal docs so the app can receive background/data notifications. The notifications are received correctly in the class, so now I want to inform the JS layer of the received notification. Per Capacitor docs, we should be able to achieve this by calling bridge.triggerJSEvent("myCustomEvent", "document", "{ 'dataKey': 'dataValue' }");.
However when this line is executed, I get an error: Attempt to invoke virtual method 'void com.getcapacitor.Bridge.triggerJSEvent(java.lang.String, java.lang.String, java.lang.String)' on a null object reference.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi everyone.
I'm trying to figure out how to use the Capacitor Android bridge in a class, not in a plugin. Specifically, I've created a native
NotificationServiceExtension
class per OneSignal docs so the app can receive background/data notifications. The notifications are received correctly in the class, so now I want to inform the JS layer of the received notification. Per Capacitor docs, we should be able to achieve this by callingbridge.triggerJSEvent("myCustomEvent", "document", "{ 'dataKey': 'dataValue' }");
.However when this line is executed, I get an error:
Attempt to invoke virtual method 'void com.getcapacitor.Bridge.triggerJSEvent(java.lang.String, java.lang.String, java.lang.String)' on a null object reference
.android/app/src/main/java/com/mycompany/myapp/NotificationServiceExtension.java:
android/app/src/main/AndroidManifest.xml
Thanks for your help!
Beta Was this translation helpful? Give feedback.
All reactions