Git Product home page Git Product logo

cordova-plugin-firebase-realtime-database's Introduction

cordova-plugin-firebase-realtime-database

Cordova plugin for Google Firebase Realtime Database Based on the the Firebase Notification / FCM plugin

Support

Please file bugs in Issues Ask for help in #cordova on the Firebase Community Slack

Installation

See npm package for versions - https://www.npmjs.com/package/cordova-plugin-firebase-realtime-database

Install the by running:

cordova plugin add cordova-plugin-firebase-realtime-database --save

Download 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:

- My Project/
    platforms/
    plugins/
    www/
    config.xml
    google-services.json       <--
    GoogleService-Info.plist   <--
    ...

See https://support.google.com/firebase/answer/7015592 for details how to download the files from firebase.

This plugin uses a hook (after prepare) that copies the configuration files to the right place, namely platforms/ios/<My Project>/Resources for iOS and platforms/android for Android.

Note that 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.

Notes about PhoneGap Build

Hooks does not work with PhoneGap Build. This means you will have to manually make sure the configuration files are included. One way to do that is to make a private fork of this plugin and replace the placeholder config files (see src/ios and src/android) with your actual ones.

Notes about Android Build

You will have to manually add the following to platforms/android/build.gradle (around line 34:

buildscript {
	...
	dependencies { 
		...
		classpath 'com.google.gms:google-services:3.0.0'
	}
}

Methods

ref

Get a reference to a child path:

var firebaseThings = window.FirebaseDatabasePlugin.ref('things');

this is the preferred way to use FirebaseDatabasePlugin

updateChildren

At a particular reference, update the given keys:

firebaseThings.updateChildren({
    'thing1' : 'aaa',
    'thing2' : 'bbb'
});

returns Promise

setValue

At a particular reference, set the given value:

firebaseThings.child('thing1').setValue('ccc');

returns Promise

setDatabasePersistent

Choose whether data should be persisted on disk, i.e. between app relaunches

window.FirebaseDatabasePlugin.setDatabasePersistent(true);

signInWithEmailAndPassword

Choose whether data should be persisted on disk, i.e. between app relaunches

window.FirebaseDatabasePlugin.signInWithEmailAndPassword(email, password);

returns Promise

cordova-plugin-firebase-realtime-database's People

Contributors

robertarnesson avatar juliocbcotta avatar hbmartin avatar c4software avatar troystopera avatar chuckv01 avatar dyxizm avatar chemerisuk avatar achuinard avatar jafidelis avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.