FCM Cordova iOS
- Install plugin cordova-plugin-firebase-messaging
cordova plugin add cordova-plugin-firebase-messaging
2. Config.xml In Cordova/condig.xml
Add path config GoogleService-Info.plist in Ios tag
<platform name="ios">
<resource-file src="GoogleService-Info.plist" />
</platform>
3. Go to Firebase console to Dowload GoogleService-Info.plist file
Project Overview > Project settings > Cloud Messaging > General > Your App > Ios app > Download the lastest config file (GoogleService-Info.plist)
then Copy to /Cordova
4. Test it by write this code in scrite
cordova.plugins.firebase.messaging.requestPermission()
.then(function() {
console.log("Push messaging is allowed");
});
cordova.plugins.firebase.messaging.getToken()
.then(function(token) {
console.log("Got device token: ", token);
});
5. Run it then your will get the Token code
Enjoy for Code with Cordova