{"_id":"@cognifit/cordova-plugin-firebasex","_rev":"3-165418acfaf6952b4a595350333a09cc","name":"@cognifit/cordova-plugin-firebasex","dist-tags":{"latest":"10.1.2"},"versions":{"10.1.2":{"name":"@cognifit/cordova-plugin-firebasex","version":"10.1.2","description":"CogniFit's fork of cordova-plugin-firebasex\nCordova plugin for Google Firebase","types":"./types/index.d.ts","author":{"name":"Dave Alden"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/cognifit/cordova-plugin-firebase.git"},"cordova":{"id":"cordova-plugin-firebase","platforms":["android","ios"]},"keywords":["ecosystem:cordova","cordova-android","cordova-ios","firebase","push","notifications","phone auth"],"scripts":{"version":"node ./bump-version.js && git add -A plugin.xml","postversion":"git push && git push --tags && npm publish --verbose","test":"npm run test:ios && npm run test:android","test:ios":"bash ./test/test-default.sh 9.0.0 ios 5.0.1","test:android":"bash ./test/test-default.sh 9.0.0 android 8.1.0 && bash ./test/test-with-3-plugins.sh 9.0.0 android 8.1.0 cordova-plugin-request-location-accuracy cordova-android-play-services-gradle-release cordova-android-firebase-gradle-release"},"dependencies":{"plist":"^3.0.1","xcode":"^3.0.1","xml-js":"^1.6.11","semver":"^7.3.2"},"gitHead":"8a712d5d871d3d30ea3bb0969e3061cee87baba6","bugs":{"url":"https://github.com/cognifit/cordova-plugin-firebase/issues"},"homepage":"https://github.com/cognifit/cordova-plugin-firebase#readme","_id":"@cognifit/cordova-plugin-firebasex@10.1.2","_nodeVersion":"15.4.0","_npmVersion":"7.2.0","dist":{"integrity":"sha512-MX+G3Q7FnXZxYN6pDPbUlN5CFjZlggCkRqZfBAEoG4IhE8Eo5c1+lgBV3XbnBTeJK1GRG/iynoIgtlLP3DxP8g==","shasum":"302ec651dc05d708c754d08728f60fa849674ad6","tarball":"https://registry.npmjs.org/@cognifit/cordova-plugin-firebasex/-/cordova-plugin-firebasex-10.1.2.tgz","fileCount":42,"unpackedSize":504696,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf6u8kCRA9TVsSAnZWagAAp4IP/RS9Djfy+bgNiqJ6LdiF\nxHFo9nsAVfGiYoVvsQps6vN7hn6OW9Xgg7vf8DCb2HLCQh6FzvZO3YkYenXh\nXqo1J1vq1pVuSApUEFBPKW2kLUdRLSSWtpAm85xdawv9sp2bDihEoV3uxjql\nzHt+0xDKbQolOoLBf+Y4c5yl8faYv9lAgC5fk73IjGemFGkXjZTvwql7gNlg\nadcEFgnwFe7FxJMHDTBsD+cNd8PsQbAVLgvceDLviDZ8dabNB6KXfZqRTcHt\nSg+JskWu91IqsdUjwiaNo41NvMNoGQDwrOjGxAUaPz7gd1d4MZhb22yp1tzt\nwwLAviVD1hD7r57s/IYUPkYIZyEwPgqhFmmbo8WcahklFbJNDaJehlgTNmxw\nm5YEjP23VEW3l467ctcZG5iZJNTFY4xgbTJxWStI4emkzakVOJqnvYJ9hISN\nAIeIbz6QRLdcAWpV3Xt+ocd5lffoBZCnu43DvSOWraD0QLPS6ahJ04M4hlSI\ncvfnmjJfzf4YxPSoKIqntD359iAO1dfH6Llo769NvRKdNPeqie9EzSuUCgWR\n7ACk0rpQN1/NIZIUqEXse5a3zdyKu7D0yKEff1Tsz6ZH7FlVpwaojomLqT+J\nb85v0ZcRp5fHf6BX3q+hEOeNcRssOCo/yuncpirAwqWLzj7H0MYpIFp6p3kp\nsnbX\r\n=OcVt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD52J9MK6gIeoxIsnqaQd6NJ+p5DXnNhtGW2ZZ73bLQjgIhAKsEnazDraC1VTcjX8UymK8x/0Co84Eb/J1aFG0CI0SK"}]},"_npmUser":{"name":"pgutierrez_cf","email":"p.gutierrez@cognifit.com"},"directories":{},"maintainers":[{"name":"pgutierrez_cf","email":"p.gutierrez@cognifit.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cordova-plugin-firebasex_10.1.2_1609232163483_0.3451942081191566"},"_hasShrinkwrap":false}},"time":{"created":"2020-12-29T08:56:03.224Z","10.1.2":"2020-12-29T08:56:03.594Z","modified":"2022-04-05T00:11:24.335Z"},"maintainers":[{"email":"m.sanfabian@cognifit.com","name":"martincognifit"},{"email":"d.olivares@cognifit.com","name":"daniolivarescognifit"},{"email":"p.gutierrez@cognifit.com","name":"pgutierrez_cf"}],"description":"CogniFit's fork of cordova-plugin-firebasex\nCordova plugin for Google Firebase","homepage":"https://github.com/cognifit/cordova-plugin-firebase#readme","keywords":["ecosystem:cordova","cordova-android","cordova-ios","firebase","push","notifications","phone auth"],"repository":{"type":"git","url":"git+https://github.com/cognifit/cordova-plugin-firebase.git"},"author":{"name":"Dave Alden"},"bugs":{"url":"https://github.com/cognifit/cordova-plugin-firebase/issues"},"license":"MIT","readme":"cordova-plugin-firebasex [![Latest Stable Version](https://img.shields.io/npm/v/cordova-plugin-firebasex.svg)](https://www.npmjs.com/package/cordova-plugin-firebasex) [![Total Downloads](https://img.shields.io/npm/dt/cordova-plugin-firebasex.svg)](https://npm-stat.com/charts.html?package=cordova-plugin-firebasex)\n========================\n\nBrings push notifications, analytics, event tracking, crash reporting and more from Google Firebase to your Cordova project.\n\nSupported platforms: Android and iOS\n\n**IMPORTANT:** Before opening an issue against this plugin, please read [Reporting issues](#reporting-issues).\n\n<!-- DONATE -->\n[![donate](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG_global.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZRD3W47HQ3EMJ)\n\nI dedicate a considerable amount of my free time to developing and maintaining this Cordova plugin, along with my other Open Source software.\nTo help ensure this plugin is kept updated, new features are added and bugfixes are implemented quickly, please donate a couple of dollars (or a little more if you can stretch) as this will help me to afford to dedicate time to its maintenance. Please consider donating if you're using this plugin in an app that makes you money, if you're being paid to make the app, if you're asking for new features or priority bug fixes.\n<!-- END DONATE -->\n\n\n<!-- START doctoc generated TOC please keep comment here to allow auto update -->\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->\n**Table of Contents**\n\n- [Installation](#installation)\n  - [Plugin variables](#plugin-variables)\n    - [Android & iOS](#android--ios)\n    - [Android only](#android-only)\n    - [iOS only](#ios-only)\n  - [Supported Cordova Versions](#supported-cordova-versions)\n  - [Supported Mobile Platform Versions](#supported-mobile-platform-versions)\n  - [Migrating from cordova-plugin-firebase](#migrating-from-cordova-plugin-firebase)\n    - [Breaking API changes](#breaking-api-changes)\n    - [Ionic 4+](#ionic-4)\n    - [Ionic 3](#ionic-3)\n- [Build environment notes](#build-environment-notes)\n  - [PhoneGap Build](#phonegap-build)\n  - [Android-specific](#android-specific)\n    - [Specifying Android library versions](#specifying-android-library-versions)\n    - [AndroidX](#androidx)\n  - [Google Play Services and Firebase libraries](#google-play-services-and-firebase-libraries)\n  - [iOS-specific](#ios-specific)\n    - [Specifying iOS library versions](#specifying-ios-library-versions)\n    - [Cocoapods](#cocoapods)\n    - [Out-of-date pods](#out-of-date-pods)\n    - [Strip debug symbols](#strip-debug-symbols)\n    - [Cordova CLI builds](#cordova-cli-builds)\n- [Firebase config setup](#firebase-config-setup)\n- [Disable data collection on startup](#disable-data-collection-on-startup)\n- [Example project](#example-project)\n- [Reporting issues](#reporting-issues)\n  - [Reporting a bug or problem](#reporting-a-bug-or-problem)\n  - [Requesting a new feature](#requesting-a-new-feature)\n- [Cloud messaging](#cloud-messaging)\n  - [Background notifications](#background-notifications)\n  - [Foreground notifications](#foreground-notifications)\n  - [Android notifications](#android-notifications)\n    - [Android background notifications](#android-background-notifications)\n    - [Android foreground notifications](#android-foreground-notifications)\n    - [Android Notification Channels](#android-notification-channels)\n      - [Android 7 and below](#android-7-and-below)\n    - [Android Notification Icons](#android-notification-icons)\n      - [Android Default Notification Icon](#android-default-notification-icon)\n      - [Android Large Notification Icon](#android-large-notification-icon)\n      - [Android Custom Notification Icons](#android-custom-notification-icons)\n    - [Android Notification Color](#android-notification-color)\n    - [Android Notification Sound](#android-notification-sound)\n      - [Android 8.0 and above](#android-80-and-above)\n      - [On Android 7 and below](#on-android-7-and-below)\n  - [iOS notifications](#ios-notifications)\n    - [iOS background notifications](#ios-background-notifications)\n    - [iOS notification sound](#ios-notification-sound)\n    - [iOS badge number](#ios-badge-number)\n    - [iOS actionable notifications](#ios-actionable-notifications)\n  - [Data messages](#data-messages)\n    - [Data message notifications](#data-message-notifications)\n      - [Android data message notifications](#android-data-message-notifications)\n      - [iOS data message notifications](#ios-data-message-notifications)\n  - [Custom FCM message handling](#custom-fcm-message-handling)\n    - [Android](#android)\n    - [iOS](#ios)\n    - [Example](#example)\n- [InApp Messaging](#inapp-messaging)\n- [Google Tag Manager](#google-tag-manager)\n  - [Android](#android-1)\n  - [iOS](#ios-1)\n- [API](#api)\n  - [Notifications and data messages](#notifications-and-data-messages)\n    - [getToken](#gettoken)\n    - [getId](#getid)\n    - [onTokenRefresh](#ontokenrefresh)\n    - [getAPNSToken](#getapnstoken)\n    - [onApnsTokenReceived](#onapnstokenreceived)\n    - [onMessageReceived](#onmessagereceived)\n    - [grantPermission](#grantpermission)\n    - [hasPermission](#haspermission)\n    - [unregister](#unregister)\n    - [isAutoInitEnabled](#isautoinitenabled)\n    - [setAutoInitEnabled](#setautoinitenabled)\n    - [setBadgeNumber](#setbadgenumber)\n    - [getBadgeNumber](#getbadgenumber)\n    - [clearAllNotifications](#clearallnotifications)\n    - [subscribe](#subscribe)\n    - [unsubscribe](#unsubscribe)\n    - [createChannel](#createchannel)\n    - [setDefaultChannel](#setdefaultchannel)\n    - [Default Android Channel Properties](#default-android-channel-properties)\n    - [deleteChannel](#deletechannel)\n    - [listChannels](#listchannels)\n  - [Analytics](#analytics)\n    - [setAnalyticsCollectionEnabled](#setanalyticscollectionenabled)\n    - [isAnalyticsCollectionEnabled](#isanalyticscollectionenabled)\n    - [logEvent](#logevent)\n    - [setScreenName](#setscreenname)\n    - [setUserId](#setuserid)\n    - [setUserProperty](#setuserproperty)\n  - [Crashlytics](#crashlytics)\n    - [setCrashlyticsCollectionEnabled](#setcrashlyticscollectionenabled)\n    - [isCrashlyticsCollectionEnabled](#iscrashlyticscollectionenabled)\n    - [setCrashlyticsUserId](#setcrashlyticsuserid)\n    - [sendCrash](#sendcrash)\n    - [logMessage](#logmessage)\n    - [logError](#logerror)\n  - [Authentication](#authentication)\n    - [isUserSignedIn](#isusersignedin)\n    - [signOutUser](#signoutuser)\n    - [getCurrentUser](#getcurrentuser)\n    - [reloadCurrentUser](#reloadcurrentuser)\n    - [updateUserProfile](#updateuserprofile)\n    - [updateUserEmail](#updateuseremail)\n    - [sendUserEmailVerification](#senduseremailverification)\n    - [updateUserPassword](#updateuserpassword)\n    - [sendUserPasswordResetEmail](#senduserpasswordresetemail)\n    - [deleteUser](#deleteuser)\n    - [createUserWithEmailAndPassword](#createuserwithemailandpassword)\n    - [signInUserWithEmailAndPassword](#signinuserwithemailandpassword)\n    - [signInUserWithCustomToken](#signinuserwithcustomtoken)\n    - [signInUserAnonymously](#signinuseranonymously)\n    - [verifyPhoneNumber](#verifyphonenumber)\n      - [Android](#android-2)\n      - [iOS](#ios-2)\n    - [authenticateUserWithGoogle](#authenticateuserwithgoogle)\n      - [Android](#android-3)\n    - [authenticateUserWithApple](#authenticateuserwithapple)\n      - [iOS](#ios-3)\n      - [Android](#android-4)\n    - [signInWithCredential](#signinwithcredential)\n    - [linkUserWithCredential](#linkuserwithcredential)\n    - [reauthenticateWithCredential](#reauthenticatewithcredential)\n    - [registerAuthStateChangeListener](#registerauthstatechangelistener)\n  - [Remote Config](#remote-config)\n    - [fetch](#fetch)\n    - [activateFetched](#activatefetched)\n    - [getValue](#getvalue)\n    - [getByteArray](#getbytearray)\n    - [getInfo](#getinfo)\n    - [setConfigSettings](#setconfigsettings)\n    - [setDefaults](#setdefaults)\n  - [Performance](#performance)\n    - [setPerformanceCollectionEnabled](#setperformancecollectionenabled)\n    - [isPerformanceCollectionEnabled](#isperformancecollectionenabled)\n    - [startTrace](#starttrace)\n    - [incrementCounter](#incrementcounter)\n    - [stopTrace](#stoptrace)\n  - [Firestore](#firestore)\n    - [addDocumentToFirestoreCollection](#adddocumenttofirestorecollection)\n    - [setDocumentInFirestoreCollection](#setdocumentinfirestorecollection)\n    - [updateDocumentInFirestoreCollection](#updatedocumentinfirestorecollection)\n    - [deleteDocumentFromFirestoreCollection](#deletedocumentfromfirestorecollection)\n    - [documentExistsInFirestoreCollection](#documentexistsinfirestorecollection)\n    - [fetchDocumentInFirestoreCollection](#fetchdocumentinfirestorecollection)\n    - [fetchFirestoreCollection](#fetchfirestorecollection)\n- [Credits](#credits)\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n\n# Installation\nInstall the plugin by adding it to your project's config.xml:\n```xml\n<plugin name=\"cordova-plugin-firebasex\" spec=\"latest\" />\n```\nor by running:\n```\ncordova plugin add cordova-plugin-firebasex\n```\n\n## Plugin variables\nThe following Cordova plugin variables are supported by the plugin.\nNote that these must be set at plugin installation time. If you wish to change plugin variables, you'll need to uninstall the plugin and reinstall it with the new variable values.\n\n### Android & iOS\n- `FIREBASE_ANALYTICS_COLLECTION_ENABLED` - whether to automatically enable Firebase Analytics data collection on app startup\n- `FIREBASE_PERFORMANCE_COLLECTION_ENABLED` - whether to automatically enable Firebase Performance data collection on app startup\n- `FIREBASE_CRASHLYTICS_COLLECTION_ENABLED` - whether to automatically enable Firebase Crashlytics data collection on app startup\nSee [Disable data collection on startup](#disable-data-collection-on-startup) for more info.\n\n### Android only\nThe following plugin variables are used to specify the Firebase SDK versions as Gradle dependencies on Android:\n- `ANDROID_PLAY_SERVICES_TAGMANAGER_VERSION`\n- `ANDROID_PLAY_SERVICES_AUTH_VERSION`\n- `ANDROID_FIREBASE_ANALYTICS_VERSION`\n- `ANDROID_FIREBASE_MESSAGING_VERSION`\n- `ANDROID_FIREBASE_CONFIG_VERSION`\n- `ANDROID_FIREBASE_PERF_VERSION`\n- `ANDROID_FIREBASE_AUTH_VERSION`\n- `$ANDROID_FIREBASE_INAPPMESSAGING_VERSION`\n- `ANDROID_FIREBASE_FIRESTORE_VERSION`\n- `ANDROID_FIREBASE_CRASHLYTICS_VERSION`\n- `ANDROID_FIREBASE_CRASHLYTICS_NDK_VERSION`\n- `ANDROID_GSON_VERSION`\nSee [Specifying Android library versions](#specifying-android-library-versions) for more info.\n\n- `ANDROID_ICON_ACCENT` - sets the default accent color for system notifications. See [Android Notification Color](#android-notification-color) for more info.\n- `ANDROID_FIREBASE_CONFIG_FILEPATH` - sets a custom filepath to `google-services.json` file as a path relative to the project root\n    - e.g. `--variable ANDROID_FIREBASE_CONFIG_FILEPATH=\"resources/android/google-services.json\"`\n\n### iOS only\n- `IOS_STRIP_DEBUG` - prevents symbolification of all libraries included via Cocoapods. See [Strip debug symbols](#strip-debug-symbols) for more info.\n    - e.g.  `--variable IOS_STRIP_DEBUG=true`\n    - Defaults to `false` if not specified.\n- `SETUP_RECAPTCHA_VERIFICATION` - automatically sets up reCAPTCHA verification for phone authentication on iOS. See [verifyPhoneNumber](#verifyphonenumber) for more info.\n    - e.g.  `--variable IOS_STRIP_DEBUG=true`\n    - Defaults to `false` if not specified.\n- `IOS_SHOULD_ESTABLISH_DIRECT_CHANNEL` - If `true` Firebase Messaging will automatically establish a socket-based, direct channel to the FCM server.\n   - e.g.  `--variable IOS_SHOULD_ESTABLISH_DIRECT_CHANNEL=true`\n   - Defaults to `false` if not specified.\n   - See [`shouldEstablishDirectChannel`](https://firebase.google.com/docs/reference/ios/firebasemessaging/api/reference/Classes/FIRMessaging#/c:objc(cs)FIRMessaging(py)shouldEstablishDirectChannel)\n   - Note: Firebase Messaging iOS SDK version 7.0 will be a breaking change where the SDK will no longer support iOS Direct Channel API.\n- `IOS_FIREBASE_CONFIG_FILEPATH` - sets a custom filepath to `GoogleService-Info.plist` file as a path relative to the project root\n    - e.g. `--variable IOS_FIREBASE_CONFIG_FILEPATH=\"resources/ios/GoogleService-Info.plist\"`\n\n## Supported Cordova Versions\n- cordova: `>= 9`\n- cordova-android: `>= 8`\n- cordova-ios: `>= 5`\n\n## Supported Mobile Platform Versions\n- Android `>= 4.1`\n- iOS `>= 10.0`\n\n## Migrating from cordova-plugin-firebase\nThis plugin is a fork of [cordova-plugin-firebase](https://github.com/arnesson/cordova-plugin-firebase) which has been reworked to fix issues and add new functionality.\nIf you already have [cordova-plugin-firebase](https://github.com/arnesson/cordova-plugin-firebase) installed in your Cordova project, you need to completely remove it before installing this plugin otherwise they will conflict and cause build errors in your project. The safest way of doing this is as follows:\n\n    rm -Rf platforms/android\n    cordova plugin rm cordova-plugin-firebase\n    rm -Rf plugins/ node_modules/\n    npm install\n    cordova plugin add cordova-plugin-firebasex\n    cordova platform add android\n\n### Breaking API changes\n**IMPORTANT:** Recent versions of `cordova-plugin-firebasex` have made breaking changes to the plugin API in order to fix bugs or add more functionality.\nTherefore you can no longer directly substitute `cordova-plugin-firebasex` in place of `cordova-plugin-firebase` without making code changes.\n\nYou should be aware of the following breaking changes compared with `cordova-plugin-firebase`:\n* Minimum supported Cordova versions\n    * `cordova@9` (CLI)\n    * `cordova-android@8` (Android platform)\n    * `cordova-ios@5` (iOS platform)\n* Migrated to AndroidX from legacy Android Support Library\n    * add dependency on [cordova-plugin-androidx](https://github.com/dpa99c/cordova-plugin-androidx) and [cordova-plugin-androidx-adapter](https://github.com/dpa99c/cordova-plugin-androidx-adapter)\n* Migrated to Cocoapods to satisfy Firebase SDK dependencies on iOS\n* `onNotificationOpen()` renamed to `onMessageReceived()`\n    * `tap` parameter is only set when user taps on a notification (not when a message is received from FCM)\n    * `tap=foreground|background` instead of `tap=true|false`\n* `hasPermission()` receives argument as a boolean (rather than an object with `isEnabled` key)\n    * e.g. `FirebasePlugin.hasPermission(function(hasPermission){\n               console.log(\"Permission is \" + (hasPermission ? \"granted\" : \"denied\"));\n           });`\n* Adds support for foreground notifications and data notification messages\n\n### Ionic 4+\nIonic Native provides a [FirebaseX Typescript wrapper](https://ionicframework.com/docs/native/firebase-x) for using `cordova-plugin-firebasex` with Ionic v4, v5 and above.\nPlease see their documentation for usage.\n\nFirst install the package.\n\n```\nionic cordova plugin add cordova-plugin-firebasex\nnpm install @ionic-native/firebase-x\n```\n\nIf you're using Angular, register it in your component/service's `NgModule` (for example, app.module.ts) as a provider.\n\n```typescript\nimport { FirebaseX } from \"@ionic-native/firebase-x/ngx\";\n\n@NgModule({\n    //declarations, imports...\n    providers: [\n        FirebaseX,\n        //other providers...\n    ]\n})\n```\n\nThen you're good to go.\n```typescript\nimport { FirebaseX } from \"@ionic-native/firebase-x/ngx\";\n\n//...\n\nconstructor(private firebase: FirebaseX)\n\nthis.firebase.getToken().then(token => console.log(`The token is ${token}`))\nthis.firebase.onMessageReceived().subscribe(data => console.log(`FCM message: ${data}`));\n```\n\n**NOTE:**\n- This plugin provides only the Javascript API as documented below.\n- The Typescript wrapper is owned and maintain by Ionic.\n- Please [report any issues](https://github.com/ionic-team/ionic-native/issues) against the [Ionic Native repo](https://github.com/ionic-team/ionic-native/), not this one.\n- Any issues opened against this repo which relate to the Typescript wrapper **will be closed immediately**.\n\n\n### Ionic 3\nThe above PR does not work for Ionic 3 so you (currently) can't use the [Ionic Native Firebase](https://ionicframework.com/docs/native/firebase) Typescript wrapper with Ionic 3.\n(i.e. `import { Firebase } from \"@ionic-native/firebase\"` will not work).\n\nTo use `cordova-plugin-firebasex` with Ionic 3, you'll need to call its Javascript API directly from your Typescript app code, for example:\n\n```typescript\n(<any>window).FirebasePlugin.getToken(token => console.log(`token: ${token}`))\n\n(<any>window).FirebasePlugin.onMessageReceived((message) => {\n    if (message.tap) { console.log(`Notification was tapped in the ${message.tap}`); }\n})\n```\n\nIf you want to make the `onMessageReceived()` JS API behave like the Ionic Native wrapper:\n\n```javascript\nonNotificationOpen() {\n      return new Observable(observer => {\n            (window as any).FirebasePlugin.onMessageReceived((response) => {\n                observer.next(response);\n            });\n       });\n}\n...\nthis.onNotificationOpen().subscribe(data => console.log(`FCM message: ${data}`));\n```\n\nSee the [cordova-plugin-firebasex-ionic3-test](https://github.com/dpa99c/cordova-plugin-firebasex-ionic3-test) example project for a demonstration of how to use the plugin with Ionic 3.\n\n# Build environment notes\n\n## PhoneGap Build\nThis plugin will not work with Phonegap Build (and other remote cloud build envs) do not support Cordova hook scripts as they are used by this plugin to configure the native platform projects.\n\n## Android-specific\n\n### Specifying Android library versions\nThis plugin depends on various components such as the Firebase SDK which are pulled in at build-time by Gradle on Android.\nBy default this plugin pins specific versions of these in [its `plugin.xml`](https://github.com/dpa99c/cordova-plugin-firebase/blob/master/plugin.xml) where you can find the currently pinned versions as `<preference>`'s, for example:\n\n```xml\n<preference name=\"ANDROID_FIREBASE_ANALYTICS_VERSION\" default=\"17.0.0\" />\n```\n\nThe Android defaults can be overridden at plugin installation time by specifying plugin variables as command-line arguments, for example:\n\n    cordova plugin add cordova-plugin-firebasex --variable ANDROID_FIREBASE_ANALYTICS_VERSION=17.0.0\n\nOr you can specify them as plugin variables in your `config.xml`, for example:\n\n```xml\n<plugin name=\"cordova-plugin-firebasex\" spec=\"latest\">\n    <variable name=\"ANDROID_FIREBASE_ANALYTICS_VERSION\" value=\"17.0.0\" />\n</plugin>\n```\n\nThe following plugin variables are used to specify the following Gradle dependency versions on Android:\n\n- `ANDROID_PLAY_SERVICES_TAGMANAGER_VERSION` => `com.google.android.gms:play-services-tagmanager`\n- `ANDROID_PLAY_SERVICES_AUTH_VERSION` => `com.google.android.gms:play-services-auth`\n- `ANDROID_FIREBASE_ANALYTICS_VERSION` => `com.google.firebase:firebase-analytics`\n- `ANDROID_FIREBASE_MESSAGING_VERSION` => `com.google.firebase:firebase-messaging`\n- `ANDROID_FIREBASE_CONFIG_VERSION` => `com.google.firebase:firebase-config`\n- `ANDROID_FIREBASE_PERF_VERSION` => `com.google.firebase:firebase-perf`\n- `ANDROID_FIREBASE_AUTH_VERSION` => `com.google.firebase:firebase-auth`\n- `ANDROID_FIREBASE_FIRESTORE_VERSION` => `com.google.firebase:firebase-firestore`\n- `$ANDROID_FIREBASE_INAPPMESSAGING_VERSION` => `com.google.firebase:firebase-inappmessaging-display`\n- `ANDROID_FIREBASE_CRASHLYTICS_VERSION` => `com.google.firebase:firebase-crashlytics`\n- `ANDROID_FIREBASE_CRASHLYTICS_NDK_VERSION` => `com.google.firebase:firebase-crashlytics-ndk`\n- `ANDROID_GSON_VERSION` => `com.google.code.gson:gson`\n\nFor example:\n\n    cordova plugin add cordova-plugin-firebasex \\\n        --variable ANDROID_PLAY_SERVICES_TAGMANAGER_VERSION=17.0.0 \\\n        --variable ANDROID_PLAY_SERVICES_AUTH_VERSION=17.0.0 \\\n        --variable ANDROID_FIREBASE_ANALYTICS_VERSION=17.0.0 \\\n        --variable ANDROID_FIREBASE_MESSAGING_VERSION=19.0.0 \\\n        --variable ANDROID_FIREBASE_CONFIG_VERSION=18.0.0 \\\n        --variable ANDROID_FIREBASE_PERF_VERSION=18.0.0 \\\n        --variable ANDROID_FIREBASE_AUTH_VERSION=18.0.0 \\\n        --variable ANDROID_FIREBASE_CRASHLYTICS_VERSION=17.0.1 \\\n        --variable ANDROID_FIREBASE_CRASHLYTICS_NDK_VERSION=17.0.1 \\\n\n### AndroidX\nThis plugin has been migrated to use [AndroidX (Jetpack)](https://developer.android.com/jetpack/androidx/migrate) which is the successor to the [Android Support Library](https://developer.android.com/topic/libraries/support-library/index).\nThis is implemented by adding a dependency on [cordova-plugin-androidx](https://github.com/dpa99c/cordova-plugin-androidx) which enables AndroidX in the Android platform of a Cordova project.\n\nThis is because the [major release of the Firebase and Play Services libraries on 17 June 2019](https://developers.google.com/android/guides/releases#june_17_2019) were migrated to AndroidX.\n\nTherefore if your project includes any plugins which are dependent on the legacy Android Support Library, you should add [cordova-plugin-androidx-adapter](https://github.com/dpa99c/cordova-plugin-androidx-adapter) to your project.\nThis plugin will dynamically migrate any plugin code from the Android Support Library to AndroidX equivalents.\n\n## Google Play Services and Firebase libraries\nYour Android build may fail if you are installing multiple plugins that use the Google Play Services library.\nThis is caused by plugins installing different versions of the Google Play Services library.\nThis can be resolved by installing [cordova-android-play-services-gradle-release](https://github.com/dpa99c/cordova-android-play-services-gradle-release) which enables you to override the versions specified by other plugins in order to align them.\n\nSimilarly, if your build is failing because multiple plugins are installing different versions of the Firebase library,\nyou can try installing [cordova-android-firebase-gradle-release](https://github.com/dpa99c/cordova-android-firebase-gradle-release) to align these.\n\n## iOS-specific\nPlease ensure you have the latest Xcode release version installed to build your app - direct download links can be [found here](https://stackoverflow.com/a/10335943/777265).\n\n### Specifying iOS library versions\nThis plugin depends on various components such as the Firebase SDK which are pulled in at build-time by Cocoapods on iOS.\nThis plugin pins specific versions of these in [its `plugin.xml`](https://github.com/dpa99c/cordova-plugin-firebase/blob/master/plugin.xml) where you can find the currently pinned iOS versions in the  `<pod>`'s, for example:\n\n    <pod name=\"Firebase/Core\" spec=\"6.3.0\"/>\n\n**It is currently not possible to override these at plugin installation time** because `cordova@9`/`cordova-ios@5` does not support the use of plugin variables in the `<pod>`'s `spec` attribute.\nTherefore if you need to change the specified versions, you'll currently need to do this by forking the plugin and editing the `plugin.xml` to change the specified `spec` values.\n\n### Cocoapods\nThis plugin relies on `cordova@9`/`cordova-ios@5` support for the [CocoaPods dependency manager]( https://cocoapods.org/) in order to satisfy the iOS Firebase SDK library dependencies.\n\nTherefore please make sure you have `cocoapods@>=1.9` installed in your iOS build environment - setup instructions can be found [here](https://cocoapods.org/).\n\nIf building your project in Xcode, you need to open `YourProject.xcworkspace` (not `YourProject.xcodeproj`) so both your Cordova app project and the Pods project will be loaded into Xcode.\n\nYou can list the pod dependencies in your Cordova iOS project by installing [cocoapods-dependencies](https://github.com/segiddins/cocoapods-dependencies):\n\n    sudo gem install cocoapods-dependencies\n    cd platforms/ios/\n    pod dependencies\n\n### Out-of-date pods\nIf you receive a build error such as this:\n\n    None of your spec sources contain a spec satisfying the dependencies: `Firebase/Analytics (~> 6.1.0), Firebase/Analytics (= 6.1.0, ~> 6.1.0)`.\n\nMake sure your local Cocoapods repo is up-to-date by running `pod repo update` then run `pod install` in `/your_project/platforms/ios/`.\n\n### Strip debug symbols\nIf your iOS app build contains too many debug symbols (i.e. because you include lots of libraries via a Cocoapods), you might get an error (e.g. [issue #28](https://github.com/dpa99c/cordova-plugin-firebase/issues/28)) when you upload your binary to App Store Connect, e.g.:\n\n    ITMS-90381: Too many symbol files - These symbols have no corresponding slice in any binary [16EBC8AC-DAA9-39CF-89EA-6A58EB5A5A2F.symbols, 1B105D69-2039-36A4-A04D-96C1C5BAF235.symbols, 476EACDF-583B-3B29-95B9-253CB41097C8.symbols, 9789B03B-6774-3BC9-A8F0-B9D44B08DCCB.symbols, 983BAE60-D245-3291-9F9C-D25E610846AC.symbols].\n\nTo prevent this, you can set the `IOS_STRIP_DEBUG` plugin variable which prevents symbolification of all libraries included via Cocoapods ([see here for more information](https://stackoverflow.com/a/48518656/777265)):\n\n    cordova plugin add cordova-plugin-firebasex --variable IOS_STRIP_DEBUG=true\n\nBy default this preference is set to `false`.\n\nNote: if you enable this setting, any crashes that occur within libraries included via Cocopods will not be recorded in Crashlytics or other crash reporting services.\n\n### Cordova CLI builds\nIf you are building (directly or indirectly) via the Cordova CLI and a build failures on iOS such as the one below:\n\n    error: Resource \"/Build/Products/Debug-iphonesimulator/FirebaseInAppMessaging/InAppMessagingDisplayResources.bundle\" not found. Run 'pod install' to update the copy resources script.\n\n\nThis is likely due to [an issue with Cordova CLI builds for iOS](https://github.com/apache/cordova-ios/issues/659) when including certain pods into the build (see [#326](https://github.com/dpa99c/cordova-plugin-firebasex/issues/326)):\n\nNote that building from Xcode works fine, so if you are able then do this.\n\nOtherwise (e.g. if building via a CI) then you'll need to switch to using the [cli_build branch](https://github.com/dpa99c/cordova-plugin-firebasex/tree/cli_build) of this plugin:\n\n    cordova plugin rm cordova-plugin-firebasex && cordova plugin add cordova-plugin-firebasex@latest-cli\n\nThis removes the Firebase Inapp Messaging and Google Tag Manager SDK components that are causing the build issues.\nThe `cli_build` branch is kept in sync with `master` but without the above components.\n\nYou can validate your CLI build environment using [this publicly-available `GoogleService-Info.plist`](https://github.coventry.ac.uk/301CEM-1920OCTJAN/301CEM-6957713/raw/master/CanaryApparel/GoogleService-Info.plist):\n\n\tcordova create test com.canary.CanaryApparel && cd test\n\tcurl https://github.coventry.ac.uk/raw/301CEM-1920OCTJAN/301CEM-6957713/master/CanaryApparel/GoogleService-Info.plist -o GoogleService-Info.plist\n\tcordova plugin add cordova-plugin-firebasex@latest-cli\n\tcordova platform add ios\n\tcordova build ios --emulator\n\t#build succeeds\n\nFollowing the installation steps above, modify the `package.json` file to pin the `cli` variant of this package by removing the `^` or `~` prefix from the package declaration. Failure to do this will result in build issues the next time the `cordova prepare` steps are performed as the non-cli version of the package will replace the cli variant.\n```\n  \"dependencies\": {\n    \"cordova-android\": \"~8.1.0\",\n    \"cordova-ios\": \"^6.1.0\",\n    \"cordova-plugin-androidx\": \"^2.0.0\",\n    \"cordova-plugin-androidx-adapter\": \"^1.1.1\",\n    \"cordova-plugin-firebasex\": \"^10.1.2-cli\" --> Change to \"10.1.2-cli\"\n  },\n```\n\n# Firebase config setup\nThere's a handy [installation and setup guide on medium.com](https://medium.com/@felipepucinelli/how-to-add-push-notifications-in-your-cordova-application-using-firebase-69fac067e821).\nHowever, if using this, remember this forked plugin is `cordova-plugin-firebasex` (not `cordova-plugin-firebase`).\n\nDownload your Firebase configuration files, `GoogleService-Info.plist` for iOS and `google-services.json` for android, and place them in the root folder of your cordova project.\nCheck out this [firebase article](https://support.google.com/firebase/answer/7015592) for details on how to download the files.\n\n```\n- My Project/\n    platforms/\n    plugins/\n    www/\n    config.xml\n    google-services.json       <--\n    GoogleService-Info.plist   <--\n    ...\n```\n\nOr you can set custom location for your platform configuration files using plugin variables in your `config.xml`:\n\n```\n<plugin name=\"cordova-plugin-firebasex\">\n    <variable name=\"ANDROID_FIREBASE_CONFIG_FILEPATH\" value=\"resources/android/google-services.json\" />\n    <variable name=\"IOS_FIREBASE_CONFIG_FILEPATH\" value=\"resources/ios/GoogleService-Info.plist\" />\n</plugin>\n```\n\nIMPORTANT: The Firebase SDK requires the configuration files to be present and valid, otherwise your app will crash on boot or Firebase features won't work.\n\n# Disable data collection on startup\nBy default, analytics, performance and Crashlytics data will begin being collected as soon as the app starts up.\nHowever, for data protection or privacy reasons, you may wish to disable data collection until such time as the user has granted their permission.\n\nTo do this, set the following plugin variables to `false` at plugin install time:\n\n* `FIREBASE_ANALYTICS_COLLECTION_ENABLED`\n* `FIREBASE_PERFORMANCE_COLLECTION_ENABLED`\n* `FIREBASE_CRASHLYTICS_COLLECTION_ENABLED`\n\n\n    cordova plugin add cordova-plugin-firebasex \\\n        --variable FIREBASE_ANALYTICS_COLLECTION_ENABLED=false \\\n        --variable FIREBASE_PERFORMANCE_COLLECTION_ENABLED=false \\\n        --variable FIREBASE_CRASHLYTICS_COLLECTION_ENABLED=false\n\nThis will disable data collection (on both Android & iOS) until you call [setAnalyticsCollectionEnabled](#setanalyticscollectionenabled), [setPerformanceCollectionEnabled](#setperformancecollectionenabled) and [setCrashlyticsCollectionEnabled](#setcrashlyticscollectionenabled):\n\n       FirebasePlugin.setAnalyticsCollectionEnabled(true);\n       FirebasePlugin.setPerformanceCollectionEnabled(true);\n       FirebasePlugin.setCrashlyticsCollectionEnabled(true);\n\nNotes:\n- Calling `setXCollectionEnabled()` will have no effect if the corresponding `FIREBASE_X_COLLECTION_ENABLED` variable is set to `true`.\n- Calling `setXCollectionEnabled(true|false)` will enable/disable data collection during the current app session and across subsequent app sessions until such time as the same method is called again with a different value.\n\n# Example project\nAn example project repo exists to demonstrate and validate the functionality of this plugin:\nhttps://github.com/dpa99c/cordova-plugin-firebasex-test\n\nPlease use this as a working reference.\n\nBefore reporting any issues, please (if possible) test against the example project to rule out causes external to this plugin.\n\n# Reporting issues\n**IMPORTANT:** Please read the following carefully.\nFailure to follow the issue template guidelines below will result in the issue being immediately closed.\n\n## Reporting a bug or problem\nBefore [opening a bug issue](https://github.com/dpa99c/cordova-plugin-firebasex/issues/new?assignees=&labels=&template=bug_report.md&title=), please do the following:\n- *DO NOT* open issues asking for support in using/integrating the plugin into your project\n    - Only open issues for suspected bugs/issues with the plugin that are generic and will affect other users\n    - I don't have time to offer free technical support: this is free open-source software\n    - Ask for help on StackOverflow, Ionic Forums, etc.\n    - Use the [example project](https://github.com/dpa99c/cordova-plugin-firebasex-test) as a known working reference\n    - Any issues requesting support will be closed immediately.\n- *DO NOT* open issues related to the  [Ionic Typescript wrapper for this plugin](https://github.com/ionic-team/ionic-native/blob/master/src/%40ionic-native/plugins/firebase-x/index.ts)\n    - This is owned/maintained by [Ionic](https://github.com/ionic-team) and is not part of this plugin\n    - Please raise such issues/PRs against [Ionic Native](https://github.com/ionic-team/ionic-native/) instead.\n\t- To verify an if an issue is caused by this plugin or its Typescript wrapper, please re-test using the vanilla Javascript plugin interface (without the Ionic Native wrapper).\n\t- Any issue opened here which is obviously an Ionic Typescript wrapper issue will be closed immediately.\n- If you are migrating from [cordova-plugin-firebase](https://github.com/arnesson/cordova-plugin-firebase) to `cordova-plugin-firebasex` please make sure you have read the [Migrating from cordova-plugin-firebase](#migrating-from-cordova-plugin-firebase) section.\n- Read the above documentation thoroughly\n    - For example, if you're having a build issue ensure you've read through the [build environment notes](#build-environment-notes)\n    - If an iOS CLI build is failing, ensure you've read the [Cordova CLI builds](#cordova-cli-builds) section\n- Check the [CHANGELOG](https://github.com/dpa99c/cordova-plugin-firebasex/blob/master/CHANGELOG.md) for any breaking changes that may be causing your issue.\n- Check a similar issue (open or closed) does not already exist against this plugin.\n\t- Duplicates or near-duplicates will be closed immediately.\n- When [creating a new issue](https://github.com/dpa99c/cordova-plugin-firebasex/issues/new/choose)\n    - Choose the \"Bug report\" template\n    - Fill out the relevant sections of the template and delete irrelevant sections\n    - *WARNING:* Failure to complete the issue template will result in the issue being closed immediately.\n- Reproduce the issue using the [example project](https://github.com/dpa99c/cordova-plugin-firebasex-test)\n\t- This will eliminate bugs in your code or conflicts with other code as possible causes of the issue\n\t- This will also validate your development environment using a known working codebase\n\t- If reproducing the issue using the example project is not possible, create an isolated test project that you are able to share\n- Include full verbose console output when reporting build issues\n    - If the full console output is too large to insert directly into the Github issue, then post it on an external site such as [Pastebin](https://pastebin.com/) and link to it from the issue\n    - Often the details of an error causing a build failure is hidden away when building with the CLI\n        - To get the full detailed console output, append the `--verbose` flag to CLI build commands\n        - e.g. `cordova build ios --verbose`\n    - Failure to include the full console output will result in the issue being closed immediately\n- If the issue relates to the plugin documentation (and not the code), please of a [documentation issue](https://github.com/dpa99c/cordova-plugin-firebasex/issues/new?assignees=&labels=&template=documentation-issue.md&title=)\n\n## Requesting a new feature\nBefore [opening a feature request issue](https://github.com/dpa99c/cordova-plugin-firebasex/issues/new?assignees=&labels=&template=feature_request.md&title=), please do the following:\n- Check the above documentation to ensure the feature you are requesting doesn't already exist\n- Check the list if open/closed issues to check if there's a reason that feature hasn't been included already\n- Ensure the feature you are requesting is actually possible to implement and generically useful to other users than yourself\n- Where possible, post a link to the documentation related to the feature you are requesting\n- Include other relevant links, e.g.\n    - Stack Overflow post illustrating a solution\n    - Code within another Github repo that illustrates a solution\n\n# Cloud messaging\n\n<p align=\"center\">\n  <a href=\"https://youtu.be/qLPhan9YUhQ\"><img src=\"https://media.giphy.com/media/U70vu02o9yCFEffidf/200w_d.gif\" /></a>\n  <span>&nbsp;</span>\n  <a href=\"https://youtu.be/35feCmGYSR4\"><img src=\"https://media.giphy.com/media/Y4oFG0Awhd3TpnggHz/200w_d.gif\" /></a>\n</p>\n\nThere are 2 distinct types of messages that can be sent by Firebase Cloud Messaging (FCM):\n\n- [Notification messages](https://firebase.google.com/docs/cloud-messaging/concept-options#notifications)\n    - automatically displayed to the user by the operating system on behalf of the client app **while your app is not running or is in the background**\n        - **if your app is in the foreground when the notification message arrives**, it is passed to the client app and it is the responsibility of the client app to display it.\n    - have a predefined set of user-visible keys and an optional data payload of custom key-value pairs.\n- [Data messages](https://firebase.google.com/docs/cloud-messaging/concept-options#data_messages)\n    - Client app is responsible for processing data messages.\n    - Data messages have only custom key-value pairs.\n\nNote: only notification messages can be sent via the Firebase Console - data messages must be sent via the [FCM APIs](https://firebase.google.com/docs/cloud-messaging/server).\n\n## Background notifications\nIf the notification message arrives while the app is in the background/not running, it will be displayed as a system notification.\n\nBy default, no callback is made to the plugin when the message arrives while the app is not in the foreground, since the display of the notification is entirely handled by the operating system.\nHowever, there are platform-specific circumstances where a callback can be made when the message arrives and the app is in the background that don't require user interaction to receive the message payload - see [Android background notifications](#android-background-notifications) and [iOS background notifications](#ios-background-notifications) for details.\n\nIf the user taps the system notification, this launches/resumes the app and the notification title, body and optional data payload is passed to the [onMessageReceived](#onMessageReceived) callback.\n\nWhen the `onMessageReceived` is called in response to a user tapping a system notification while the app is in the background/not running, it will be passed the property `tap: \"background\"`.\n\n\n## Foreground notifications\nIf the notification message arrives while the app is in running in the foreground, by default **it will NOT be displayed as a system notification**.\nInstead the notification message payload will be passed to the [onMessageReceived](#onMessageReceived) callback for the plugin to handle (`tap` will not be set).\n\nIf you include the `notification_foreground` key in the `data` payload, the plugin will also display a system notification upon receiving the notification messages while the app is running in the foreground.\nFor example:\n\n```json\n{\n  \"name\": \"my_notification\",\n  \"notification\": {\n    \"body\": \"Notification body\",\n    \"title\": \"Notification title\"\n  },\n  \"data\": {\n    \"notification_foreground\": \"true\",\n  }\n}\n```\n\nWhen the `onMessageReceived` is called in response to a user tapping a system notification while the app is in the foreground, it will be passed the property `tap: \"foreground\"`.\n\nYou can set additional properties of the foreground notification using the same key names as for [Data Message Notifications](#data-message-notification-keys).\n\n## Android notifications\nNotifications on Android can be customised to specify the sound, icon, LED colour, etc. that's displayed when the notification arrives.\n\n### Android background notifications\nIf the notification message arrives while the app is in the background/not running, it will be displayed as a system notification.\n\nIf a notification message arrives while the app is in the background but is still running (i.e. has not been task-killed) and the device is not in power-saving mode, the `onMessageReceived` callback will be invoked without the `tap` property, indicating the message was received without user interaction.\n\nIf the user then taps the system notification, the app will be brought to the foreground and `onMessageReceived` will be invoked **again**, this time with `tap: \"background\"` indicating that the user tapped the system notification while the app was in the background.\n\nIn addition to the title and body of the notification message, Android system notifications support specification of the following notification settings:\n- [Icon](#android-notification-icons)\n- [Sound](#android-notification-sound)\n- [Color accent](#android-notification-color)\n- [Channel ID](#android-notification-channels) (Android 8.0 (O) and above)\n    - This channel configuration enables you to specify:\n        - Sound\n        - Vibration\n        - LED light\n        - Badge\n        - Importance\n        - Visibility\n    - See [createChannel](#createchannel) for details.\n\nNote: on tapping a background notification, if your app is not running, only the `data` section of the notification message payload will be delivered to [onMessageReceived](#onMessageReceived).\ni.e. the notification title, body, etc. will not. Therefore if you need the properties of the notification message itself (e.g. title & body) to be delivered to [onMessageReceived](#onMessageReceived), you must duplicate these in the `data` section, e.g.:\n\n```json\n{\n  \"name\": \"my_notification\",\n  \"notification\": {\n    \"body\": \"Notification body\",\n    \"title\": \"Notification title\"\n  },\n  \"data\": {\n    \"notification_body\": \"Notification body\",\n    \"notification_title\": \"Notification title\"\n  }\n}\n```\n\n### Android foreground notifications\nIf the notification message arrives while the app is in the foreground, by default a system notification won't be displayed and the data will be passed to [onMessageReceived](#onMessageReceived).\n\nHowever, if you set the `notification_foreground` key in the `data` section of the notification message payload, this will cause the plugin to display system notification when the message is received while your app is in the foreground. You can customise the notification using the same keys as for [Android data message notifications](#android-data-message-notifications).\n\n### Android Notification Channels\n- Android 8 (O) introduced [notification channels](https://developer.android.com/training/notify-user/channels).\n- Notification channels are configured by the app and used to determine the **sound/lights/vibration** settings of system notifications.\n- By default, this plugin creates a default channel with [default properties](#default-android-channel-properties)\n    - These can be overridden via the [setDefaultChannel](#setdefaultchannel) function.\n- The plugin enables the creation of additional custom channels via the [createChannel](#createchannel) function.\n\nFirst you need to create a custom channel with the desired settings, for example:\n\n```javascript\nvar channel  = {\n    id: \"my_channel_id\",\n    sound: \"mysound\",\n    vibration: true,\n    light: true,\n    lightColor: parseInt(\"FF0000FF\", 16).toString(),\n    importance: 4,\n    badge: true,\n    visibility: 1\n};\n\nFirebasePlugin.createChannel(channel,\nfunction(){\n    console.log('Channel created: ' + channel.id);\n},\nfunction(error){\n   console.log('Create channel error: ' + error);\n});\n```\n\nThen reference it from your message payload:\n\n```json\n{\n  \"name\": \"my_notification\",\n  \"notification\": {\n    \"body\": \"Notification body\",\n    \"title\": \"Notification title\"\n  },\n  \"android\": {\n    \"notification\": {\n      \"channel_id\": \"my_channel_id\"\n    }\n  }\n}\n```\n\n#### Android 7 and below\n- the channel referenced in the message payload will be ignored\n- the sound setting of system notifications is specified in the notification message itself - see [Android Notification Sound](#android-notification-sound).\n\n\n### Android Notification Icons\nBy default the plugin will use the default app icon for notification messages.\n\n#### Android Default Notification Icon\nTo define a custom default notification icon, you need to create the images and deploy them to the `<projectroot>/platforms/android/app/src/main/res/<drawable-DPI>` folders.\nThe easiest way to create the images is using the [Image Asset Studio in Android Studio](https://developer.android.com/studio/write/image-asset-studio#create-notification) or using the [Android Asset Studio webapp](https://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.type=clipart&source.clipart=ac_unit&source.space.trim=1&source.space.pad=0&name=notification_icon).\n\nThe icons should be monochrome transparent PNGs with the following sizes:\n\n- mdpi: 24x24\n- hdpi: 36x36\n- xhdpi: 48x48\n- xxhdpi: 72x72\n- xxxhdpi: 96x96\n\nOnce you've created the images, you need to deploy them from your Cordova project to the native Android project.\nTo do this, copy the `drawable-DPI` image directories into your Cordova project and add `<resource-file>` entries to the `<platform name=\"android\">` section of your `config.xml`, where `src` specifies the relative path to the images files within your Cordova project directory.\n\nFor example, copy the`drawable-DPI` image directories to `<projectroot>/res/android/` and add the following to your `config.xml`:\n\n```xml\n<platform name=\"android\">\n    <resource-file src=\"res/android/drawable-mdpi/notification_icon.png\" target=\"app/src/main/res/drawable-mdpi/notification_icon.png\" />\n    <resource-file src=\"res/android/drawable-hdpi/notification_icon.png\" target=\"app/src/main/res/drawable-hdpi/notification_icon.png\" />\n    <resource-file src=\"res/android/drawable-xhdpi/notification_icon.png\" target=\"app/src/main/res/drawable-xhdpi/notification_icon.png\" />\n    <resource-file src=\"res/android/drawable-xxhdpi/notification_icon.png\" target=\"app/src/main/res/drawable-xxhdpi/notification_icon.png\" />\n    <resource-file src=\"res/android/drawable-xxxhdpi/notification_icon.png\" target=\"app/src/main/res/drawable-xxxhdpi/notification_icon.png\" />\n</platform>\n```\n\nThe default notification icon images **must** be named `notification_icon.png`.\n\nYou then need to add a `<config-file>` block to the `config.xml` which will instruct Firebase to use your icon as the default for notifications:\n\n```xml\n<platform name=\"android\">\n    <config-file target=\"AndroidManifest.xml\" parent=\"/manifest/application\">\n        <meta-data android:name=\"com.google.firebase.messaging.default_notification_icon\" android:resource=\"@drawable/notification_icon\" />\n    </config-file>\n</platform>\n```\n\n\n#### Android Large Notification Icon\nThe default notification icons above are monochrome, however you can additionally define a larger multi-coloured icon.\n\n**NOTE:** FCM currently does not support large icons in system notifications displayed for notification messages received in the while the app is in the background (or not running).\nSo the large icon will currently only be used if specified in [data messages](#android-data-messages) or [foreground notifications](#foreground-notifications).\n\nThe large icon image should be a PNG-24 that's 256x256 pixels and must be named `notification_icon_large.png` and should be placed in the `drawable-xxxhdpi` resource directory.\nAs with the small icons, you'll need to add a `<resource-file>` entry to the `<platform name=\"android\">` section of your `config.xml`:\n\n```xml\n<platform name=\"android\">\n    <resource-file src=\"res/android/drawable-xxxhdpi/notification_icon_large.png\" target=\"app/src/main/res/drawable-xxxhdpi/notification_icon_large.png\" />\n</platform>\n```\n\n\n#### Android Custom Notification Icons\nYou can define additional sets of notification icons in the same manner as above.\nThese can be specified in notification or data messages.\n\nFor example:\n\n```xml\n        <resource-file src=\"res/android/drawable-mdpi/my_icon.png\" target=\"app/src/main/res/drawable-mdpi/my_icon.png\" />\n        <resource-file src=\"res/android/drawable-hdpi/my_icon.png\" target=\"app/src/main/res/drawable-hdpi/my_icon.png\" />\n        <resource-file src=\"res/android/drawable-xhdpi/my_icon.png\" target=\"app/src/main/res/drawable-xhdpi/my_icon.png\" />\n        <resource-file src=\"res/android/drawable-xxhdpi/my_icon.png\" target=\"app/src/main/res/drawable-xxhdpi/my_icon.png\" />\n        <resource-file src=\"res/android/drawable-xxxhdpi/my_icon.png\" target=\"app/src/main/res/drawable-xxxhdpi/my_icon.png\" />\n        <resource-file src=\"res/android/drawable-xxxhdpi/my_icon_large.png\" target=\"app/src/main/res/drawable-xxxhdpi/my_icon_large.png\" />\n```\n\nWhen sending an FCM notification message, you will then specify the icon name in the `android.notification` section, for example:\n\n```json\n{\n  \"name\": \"my_notification\",\n  \"notification\": {\n    \"body\": \"Notification body\",\n    \"title\": \"Notification title\"\n  },\n  \"android\": {\n    \"notification\": {\n      \"icon\": \"my_icon\",\n    }\n  },\n  \"data\": {\n    \"notification_foreground\": \"true\",\n  }\n}\n```\n\nYou can also reference these icons in [data messages](#android-data-messages), for example:\n\n```json\n{\n  \"name\": \"my_data\",\n  \"data\" : {\n    \"notification_foreground\": \"true\",\n    \"notification_body\" : \"Notification body\",\n    \"notification_title\": \"Notification title\",\n    \"notification_android_icon\": \"my_icon\",\n  }\n}\n```\n\n\n### Android Notification Color\nOn Android Lollipop (5.0/API 21) and above you can set the default accent color for the notification by adding a color setting.\nThis is defined as an [ARGB colour](https://en.wikipedia.org/wiki/RGBA_color_space#ARGB_(word-order)) which the plugin sets by default to `#FF00FFFF` (cyan).\nNote: On Android 7 and above, the accent color can only be set for the notification displayed in the system tray area - the icon in the statusbar is always white.\n\nYou can override this default by specifying a value using the `ANDROID_ICON_ACCENT` plugin variable during plugin installation, for example:\n\n    cordova plugin add cordova-plugin-firebasex --variable ANDROID_ICON_ACCENT=#FF123456\n\nYou can override the default color accent by specifying the `colour` key as an RGB value in a notification message, e.g.:\n\n```json\n{\n  \"name\": \"my_notification\",\n  \"notification\": {\n    \"body\": \"Notification body\",\n    \"title\": \"Notification title\"\n  },\n  \"android\": {\n    \"notification\": {\n      \"color\": \"#00ff00\"\n    }\n  }\n}\n```\n\nAnd in a data message:\n\n```json\n{\n  \"name\": \"my_data\",\n  \"data\" : {\n    \"notification_foreground\": \"true\",\n    \"notification_body\" : \"Notification body\",\n    \"notification_title\": \"Notification title\",\n    \"notification_android_color\": \"#00ff00\"\n  }\n}\n```\n\n### Android Notification Sound\nYou can specify custom sounds for notifications or play the device default notification sound.\n\nCustom sound files must be in `.mp3` format and deployed to the `/res/raw` directory in the Android project.\nTo do this, you can add `<resource-file>` tags to your `config.xml` to deploy the files, for example:\n\n```xml\n<platform name=\"android\">\n    <resource-file src=\"res/android/raw/my_sound.mp3\" target=\"app/src/main/res/raw/my_sound.mp3\" />\n</platform>\n```\n\nTo ensure your custom sounds works on all versions of Android, be sure to include both the channel name and sound name in your message payload (see below for details), for example:\n\n```json\n{\n  \"name\": \"my_notification\",\n  \"notification\": {\n    \"body\": \"Notification body\",\n    \"title\": \"Notification title\"\n  },\n  \"android\": {\n    \"notification\": {\n      \"channel_id\": \"my_channel_id\",\n      \"sound\": \"my_sound\"\n    }\n  }\n}\n```\n\n#### Android 8.0 and above\nOn Android 8.0 and above, the notification sound is specified by which [Android notification channel](#android-notification-channels) is referenced in the notification message payload.\nFirst create a channel that references your sound, for example:\n\n```javascript\nvar channel  = {\n    id: \"my_channel_id\",\n    sound: \"my_sound\"\n};\n\nFirebasePlugin.createChannel(channel,\nfunction(){\n    console.log('Channel created: ' + channel.id);\n},\nfunction(error){\n   console.log('Create channel error: ' + error);\n});\n```\n\nThen reference that channel in your message payload:\n\n```json\n{\n  \"name\": \"my_notification\",\n  \"notification\": {\n    \"body\": \"Notification body\",\n    \"title\": \"Notification title\"\n  },\n  \"android\": {\n    \"notification\": {\n      \"channel_id\": \"my_channel_id\"\n    }\n  }\n}\n```\n\n#### On Android 7 and below\nOn Android 7 and below, you need to specify the sound file name in the `android.notification` section of the message payload.\nFor example:\n\n```json\n{\n  \"name\": \"my_notification\",\n  \"notification\": {\n    \"body\": \"Notification body\",\n    \"title\": \"Notification title\"\n  },\n  \"android\": {\n    \"notification\": {\n      \"sound\": \"my_sound\"\n    }\n  }\n}\n```\n\nAnd in a data message by specifying it in the `data` section:\n\n```json\n{\n  \"name\": \"my_data\",\n  \"data\" : {\n    \"notification_foreground\": \"true\",\n    \"notification_body\" : \"Notification body\",\n    \"notification_title\": \"Notification title\",\n    \"notification_android_sound\": \"my_sound\"\n  }\n}\n```\n\n- To play the default notification sound, set `\"sound\": \"default\"`.\n- To display a silent notification (no sound), omit the `sound` key from the message.\n\n## iOS notifications\nNotifications on iOS can be customised to specify the sound and badge number that's displayed when the notification arrives.\n\nNotification settings are specified in the `apns.payload.aps` key of the notification message payload.\nFor example:\n\n```json\n{\n  \"name\": \"my_notification\",\n  \"notification\": {\n    \"body\": \"Notification body\",\n    \"title\": \"Notification title\"\n  },\n  \"apns\": {\n      \"payload\": {\n        \"aps\": {\n          \"sound\": \"default\",\n          \"badge\": 1,\n          \"content-available\": 1\n        }\n      }\n    }\n}\n```\n\n### iOS background notifications\nIf the app is in the background but is still running (i.e. has not been task-killed) and the device is not in power-saving mode, the `onMessageReceived` callback can be invoked when the message arrives without requiring user interaction (i.e. tapping the system notification).\nTo do this you must specify `\"content-available\": 1` in the `apns.payload.aps` section of the message payload - see the [Apple documentation](https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW8) for more information.\nWhen the message arrives, the `onMessageReceived` callback will be invoked without the `tap` property, indicating the message was received without user interaction.\nIf the user then taps the system notification, the app will be brought to the foreground and `onMessageReceived` will be invoked **again**, this time with `tap: \"background\"` indicating that the user tapped the system notification while the app was in the background.\n\n### iOS notification sound\nYou can specify custom sounds for notifications or play the device default notification sound.\n\nCustom sound files must be in a supported audio format (see [this Apple documentation](https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/SupportingNotificationsinYourApp.html#//apple_ref/doc/uid/TP40008194-CH4-SW10) for supported formats).\nFor example to convert an `.mp3` file to the supported `.caf` format run:\n\n    afconvert my_sound.mp3 my_sound.caf -d ima4 -f caff -v\n\nSound files must be deployed with the iOS application bundle.\nTo do this, you can add `<resource-file>` tags to your `config.xml` to deploy the files, for example:\n\n```xml\n<platform name=\"ios\">\n    <resource-file src=\"res/ios/sound/my_sound.caf\" />\n</platform>\n```\n\nIn a notification message, specify the `sound` key in the `apns.payload.aps` section, for example:\n\n```json\n{\n  \"name\": \"my_notification\",\n  \"notification\": {\n    \"body\": \"Notification body\",\n    \"title\": \"Notification title\"\n  },\n  \"apns\": {\n      \"payload\": {\n        \"aps\": {\n          \"sound\": \"my_sound.caf\"\n        }\n      }\n    }\n}\n```\n\n- To play the default notification sound, set `\"sound\": \"default\"`.\n- To display a silent notification (no sound), omit the `sound` key from the message.\n\nIn a data message, specify the `notification_ios_sound` key in the `data` section:\n\n```json\n{\n  \"name\": \"my_data\",\n  \"data\" : {\n    \"notification_foreground\": \"true\",\n    \"notification_body\" : \"Notification body\",\n    \"notification_title\": \"Notification title\",\n    \"notification_ios_sound\": \"my_sound.caf\"\n  }\n}\n```\n\n### iOS badge number\nIn a notification message, specify the `badge` key in the `apns.payload.aps` section, for example:\n\n```json\n{\n  \"name\": \"my_notification\",\n  \"notification\": {\n    \"body\": \"Notification body\",\n    \"title\": \"Notification title\"\n  },\n  \"apns\": {\n      \"payload\": {\n        \"aps\": {\n          \"badge\": 1\n        }\n      }\n    }\n}\n```\n\nIn a data message, specify the `notification_ios_badge` key in the `data` section:\n\n```json\n{\n  \"name\": \"my_data\",\n  \"data\" : {\n    \"notification_foreground\": \"true\",\n    \"notification_body\" : \"Notification body\",\n    \"notification_title\": \"Notification title\",\n    \"notification_ios_badge\": 1\n  }\n}\n```\n\n### iOS actionable notifications\n[Actionable notifications](https://developer.apple.com/documentation/usernotifications/declaring_your_actionable_notification_types) are supported on iOS:\n\n<img width=\"300\" src=\"https://user-images.githubusercontent.com/2345062/90025071-88c0a180-dcad-11ea-86f7-033f84601a56.png\"/>\n<img width=\"300\" src=\"https://user-images.githubusercontent.com/2345062/90028234-531db780-dcb1-11ea-9df3-6bfcf8f2e9d8.png\"/>\n\nTo use them in your app you must do the following:\n\n1. Add a `pn-actions.json` file to your Cordova project which defines categories and actions, for example:\n\n```json\n    {\n      \"PushNotificationActions\": [\n        {\n          \"category\": \"news\",\n          \"actions\": [\n            {\n              \"id\": \"read\", \"title\": \"Read\"\n            },\n            {\n              \"id\": \"skip\", \"title\": \"Skip\"\n            },\n            {\n              \"id\": \"add\", \"title\": \"Add to list\"\n            }\n          ]\n        }\n      ]\n    }\n```\n\n2. Reference it as a resource file in your `config.xml`:\n\n```xml\n    <platform name=\"ios\">\n        ...\n        <resource-file src=\"relative/path/to/pn-actions.json\" />\n    </platform>\n```\n\n3. Add a category entry to your FCM message payload which references one of your categories:\n\n```json\n{\n  \"notification\": {\n      \"title\": \"iOS Actionable Notification\",\n      \"body\": \"With custom buttons\"\n  },\n  \"apns\": {\n    \"payload\": {\n      \"aps\": {\n        \"category\": \"news\"\n      }\n    }\n  }\n}\n```\n\nWhen the notification arrives, if the user presses an action button the [`onMessageReceived()`](#onmessagereceived) function is invoked with the notification message payload, including the corresponding action ID.\nFor example:\n\n```json\n{\n    \"action\": \"read\",\n    \"google.c.a.e\": \"1\",\n    \"notification_foreground\": \"true\",\n    \"aps\": {\n        \"alert\": {\n            \"title\": \"iOS Actionable Notification\",\n            \"body\": \"With custom buttons\"\n        },\n        \"category\": \"news\"\n    },\n    \"gcm.message_id\": \"1597240847657854\",\n    \"tap\": \"background\",\n    \"messageType\": \"notification\"\n}\n```\n\nSo you can obtain the category with `message.aps.category` and the action with `message.action` and handle this appropriately in your app code.\n\nNotes:\n- Actionable notifications are currently only available for iOS - not Android\n- To reveal the notification action buttons, the user must drag downwards on the notification dialog\n- Actionable notifications work with both foreground and background (system) notifications\n- If your app is in the background/not running when the notification message arrives and a system notification is displayed, if the user chooses an action (instead of tapping the notification dialog body), your app will not be launched/foregrounded but [`onMessageReceived()`](#onmessagereceived) will be invoked, enabling your app code to handle the user's action selection silently in the background.\n- You can test out actionable notifications by building and running [example project](https://github.com/dpa99c/cordova-plugin-firebasex-test) app and sending the [ios_notification_actionable.json](https://github.com/dpa99c/cordova-plugin-firebasex-test/blob/master/messages/ios_notification_actionable.json) FCM message using the [built-in FCM v1 HTTP API client](https://github.com/dpa99c/cordova-plugin-firebasex-test#messaging-client) which contains a category defined in the example [pn-actions.json](https://github.com/dpa99c/cordova-plugin-firebasex-test/blob/master/res/ios/pn-actions.json).\n\n## Data messages\nFCM data messages are sent as an arbitrary k/v structure and by default are passed to the app for it to handle them.\n\n**NOTE:** FCM data messages **cannot** be sent from the Firebase Console - they can only be sent via the FCM APIs.\n\n### Data message notifications\nThis plugin enables a data message to be displayed as a system notification.\nTo have the app display a notification when the data message arrives, you need to set the `notification_foreground` key in the `data` section.\nYou can then set a `notification_title` and `notification_body`, for example:\n\n```json\n{\n  \"name\": \"my_data\",\n  \"data\" : {\n    \"notification_foreground\": \"true\",\n    \"notification_body\" : \"Notification body\",\n    \"notification_title\": \"Notification title\",\n    \"foo\" : \"bar\"\n  }\n}\n```\n\nAdditional platform-specific notification options can be set using the additional keys below (which are only relevant if the `notification_foreground` key is set).\n\nNote: [foreground notification messages](#foreground-notifications) can also make use of these keys.\n\n#### Android data message notifications\nOn Android:\n- Data messages that arrive while your app is running in the foreground or running in the background will be immediately passed to the `onMessageReceived()` Javascript handler in the Webview.\n- Data messages (not containing notification keys) that arrive while your app is **not running** will be passed to the `onMessageReceived()` Javascript handler when the app is next launched.\n- Data messages containing notification keys that arrive while your app is running or **not running** will be displayed as a system notification.\n\nThe following Android-specific keys are supported and should be placed inside the `data` section:\n\n- `notification_android_icon` - name of a [custom notification icon](#android-custom-notification-icons) in the drawable resources\n    - if not specified, the plugin will use the default `notification_icon` if it exists; otherwise the default app icon will be displayed\n    - if a [large icon](#android-large-notification-icon) has been defined, it will also be displayed in the system notification.\n- `notification_android_color` - the [color accent](#android-notification-color) to use for the small notification icon\n    - if not specified, the default color accent will be used\n- `notification_android_channel_id` - ID of the [notification channel](#android-notification-channels) to use to display the notification\n    - Only applies to Android 8.0 and above\n    - If not specified, the [default notification channel](#default-android-channel-properties) will be used.\n        - You can override the default configuration for the default notification channel using [setDefaultChannel](#setdefaultchannel).\n    - You can create additional channels using [createChannel](#createchannel).\n- `notification_android_priority` - Specifies the notification priority\n    - Possible values:\n        - `2` - Highest notification priority for your application's most important items that require the user's prompt attention or input.\n        - `1` - Higher notification priority for more important notifications or alerts.\n        - `0` - Default notification priority.\n        - `-1` - Lower notification priority for items that are less important.\n        - `-2` - Lowest notification priority. These items might not be shown to the user except under special circumstances, such as detailed notification logs.\n    - Defaults to `2` if not specified.\n- `notification_android_visibility` - Specifies the notification visibility\n    - Possible values:\n        - `1` - Show this notification in its entirety on all lockscreens.\n        - `0` - Show this notification on all lockscreens, but conceal sensitive or private information on secure lockscreens.\n        - `-1` - Do not reveal any part of this notification on a secure lockscreen.\n    - Defaults to `1` if not specified.\n\nThe following keys only apply to Android 7 and below.\nOn Android 8 and above they will be ignored - the `notification_android_channel_id` property should be used to specify a [notification channel](#android-notification-channels) with equivalent settings.\n\n- `notification_android_sound` - name of a sound resource to play as the [notification sound](#android-notification-sound)\n    - if not specified, no sound is played\n    - `default` plays the default device notification sound\n    - otherwise should be the name of an `.mp3` file in the `/res/raw` directory, e.g. `my_sound.mp3` => `\"sounds\": \"my_sound\"`\n- `notification_android_lights` - color and pattern to use to blink the LED light\n    - if not defined, LED will not blink\n    - in the format `ARGB, time_on_ms, time_off_ms` where\n        - `ARGB` is an ARGB color definition e.g. `#ffff0000`\n        - `time_on_ms` is the time in milliseconds to turn the LED on for\n        - `time_off_ms` is the time in milliseconds to turn the LED off for\n    - e.g. `\"lights\": \"#ffff0000, 250, 250\"`\n- `notification_android_vibrate` - pattern of vibrations to use when the message arrives\n    - if not specified, device will not vibrate\n    - an array of numbers specifying the time in milliseconds to vibrate\n    - e.g. `\"vibrate\": \"500, 200, 500\"`\n\nExample data m","readmeFilename":"README.md"}