I migrated my Cordova project to capacitor 6.0.0 (without a framework). My app uses jQuery Mobile, and the code is maintained in Android Studio. I managed to get all plugins to work except the cordova-plugin-fcm which is incompatible with capacitor. Instead I want to use the @capacitor-firebase/messaging, but I am unable to find any documentations/demos on how to include it in my project in Javascript.
The only documentation that I find is for capacitor with some type of framework.
2
Answers
I managed to solve it.
Make sure the @capacitor-firebase/messaging plugin is installed
Include this code in capacitor.config.json file inside "plugins"
Include this code in your JavaScript file.
To test app notification, first you need to get the token of your emulator or physical device. To do this, run the app, you will see the token in the console.
Run your app. Make sure it's in the background (i.e., not visible on the screen). Then login to firebase console, choose send a message to a test device, enter the token and send the message.
You just need to import it as described in the documentation:
Here is an example of using a Capacitor plugin without any framework.