GithubHelp home page GithubHelp logo

hbmartin / cordova-plugin-firebase-realtime-database Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arnesson/cordova-plugin-firebase

13.0 7.0 8.0 40.1 MB

Cordova plugin for Google Firebase

JavaScript 2.99% Java 4.20% Objective-C 76.17% C++ 11.39% C 5.25%

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

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

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

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

Plugin with id 'com.google.gms.google-services' not found.

Hi,

I get this issue when building the app using cordova 6.4.0:

Script '/tmp/builds/4tmao7lheXDJrUXHXa/app/Plugins/cordova-plugin-firebase-realtime-database/src/android/build-extras.gradle' line: 11

  • What went wrong:
    A problem occurred evaluating root project 'app'.
    Warning: > Plugin with id 'com.google.gms.google-services' not found.

how can read database

please Suggest me how can i read data real time
i want it so real
i can write in database using this demo but can't read

Calling setDatabasePersistent crashes the app

Using cordova 6.3.1 and testing on Android.

I was able to create an app with your plugin that updates values in firebase. However, once I added the
window.FirebaseDatabasePlugin.setDatabasePersistent(true); line to the code the app crashes hard and I don't know what the exception is. FYI - window.FirebaseDatabasePlugin.setDatabasePersistent(false); does the same thing.

I tried catching and and setting an error but nothing gets reported back to my app. With the following code the app doesn't crash but I don't see the error reported anywhere either:

            try{
                    FirebaseDatabase.getInstance().setPersistenceEnabled(persistent);
                } catch (Exception e) {                    
                    callbackContext.error(e.getMessage());
                }

Are there any special permission or other plugins needed to use this option?

Plugin download failed npm ERR! zlib: unexpected end of file

cordova plugin add cordova-plugin-firebase-realtime-database --save
Failed to fetch plugin cordova-plugin-firebase-realtime-database via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 4294967291 Error output:
npm ERR! code Z_BUF_ERROR
npm ERR! errno -5
npm ERR! zlib: unexpected end of file

Please check this. My connection is okay and working for other plugin

Failed to apply plugin [id 'com.google.gms.google-services'] > For input string: "+"

After adding cordova-plugin-firebase-realtime-database to project , getting following error while building the project,

cordova build android
ANDROID_HOME=C:\Users\guest\Downloads\tools_r25.2.3-windows
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121
Subproject Path: CordovaLib
handscan-build-extras

FAILURE: Build failed with an exception.

  • Where:
    Script 'C:\Users\guest\Documents\cordova_projects\myapp\platforms\android\cordova-plugin-firebase-realtime-database\myapp-build-extras.gradle' line: 11

  • What went wrong:
    A problem occurred evaluating root project 'android'.
    BUILD FAILED

Total time: 1.9 secs

Failed to apply plugin [id 'com.google.gms.google-services']
For input string: "+"

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Getting native database support merged upstream

Hi! We're very keen on using the native Firebase database support you implemented (notably the persistence piece)

We're curious why you haven't opened a merge request to get this included into the cordova-plugin-firebase plugin (the upstream of your fork) vs. maintaining this as its own separate plugin?

Thanks

How to get value of a child

Hello, this plugin is very helpful for highbird mobile app developer. But the features is limited. I can write data successfully into database. But I could not find any such function that can read database(realtime). I am developing an app for IOT project. I need to read realtime data into my app. Any solution or suggestion will be highly appreciated. Thanks in advance.

Uncaught TypeError: Cannot read property 'ref' of undefined

After installing the plugin with "cordova plugin add cordova-plugin-firebase-realtime-database --save", I added classpath 'com.google.gms:google-services:3.0.0' in build.gradle and in the function ReceiveEvent I added var firebaseThings = window.FirebaseDatabasePlugin.ref('farmacias');

When I run cordova run browser I get the error Uncaught TypeError: Cannot read property 'ref' of undefined

How to solve this problem?

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.