Home

Awesome

cordova-plugin-firebasex-test

This repo contains a Cordova project which builds a test app for cordova-plugin-firebasex which is a fork of cordova-plugin-firebase that has been updated to fix several issues.

CLI build instructions

git clone https://github.com/dpa99c/cordova-plugin-firebasex-test.git && cd cordova-plugin-firebasex-test
npm install

cordova platform add ios
cordova run ios

cordova platform add android
cordova run android

iOS build notes

iOS package ID

The configured package ID for this test project is uk.co.workingedge.firebase.test which I have registered with my Apple Developer Team in order to create an iOS provisioning profile with appropriate permissions.

Therefore in order to test this project on iOS, you will need to change the package ID to one which is associated with your Apple Developer Team and for which you have set appropriate capabilities.

Cocopods

cordova-plugin-firebasex relies on cordova@9/cordova-ios@5 support for the CocoaPods dependency manager in order to satify the iOS Firebase SDK library dependencies.

Therefore please make sure you have Cocoapods installed in your iOS build environment - setup instructions can be found here. Also make sure your local Cocoapods repo is up-to-date by running pod repo update.

Building in Xcode

If 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.

Testing Cloud Messaging

If you want to test FCM using this project, you'll need to do the following:

iOS

Android

You can send notification (but not data) messages using the Firebase Console.

Messaging client

In order to send both data and notification messages for testing, this repo includes a messaging client written in nodejs to send predefined messages via the FCM v1 HTTP API for testing.

Setup messaging client

In order to setup the messaging client, you first need to download a "service account" private key file from your Firebase project and save it into the root of this repo:

Send test messages

Use the following syntax:

npm run-script send -- --token="<your_device_token>" --message=<message_name>.json

where <your_device_token> is the token you noted down and <message_name> is the name of a message file in the messages/ directory, for example:

npm run-script send -- --message=notification.json --token="cJlSa4UjtO0:APA91bFNDPVnHaS1__UTdNc8kt3uplnxBOcPGBbEO37J0FU3vFgGyud7gWDT2RJ5VmSJ68qFyiCu0y-WWcur7hE8RelRkzlS3RK6edFycpvm4K2szsMqMXOxEy72V9a41u6kaVh7U4nz"

Testing authentication

To test the authentication methods, you must configure each method for the target mobile platform as outlined in the plugin documentation for that method.

Android

Set your server client ID in www/js/config.js - see the Firebase documentation for where to find this. This is used for Google Sign In on Android.

Analytics DebugView

See this page for how to manually enable Firebase Analytics DebugView.