Git Product home page Git Product logo

firebaseui-android's Introduction

FirebaseUI for Android — UI Bindings for Firebase

FirebaseOpensource.com Actions Status

FirebaseUI is an open-source library for Android that allows you to quickly connect common UI elements to Firebase APIs.

A compatible FirebaseUI client is also available for iOS.

Table of contents

  1. Usage
  2. Installation
    1. Upgrading
  3. Dependencies
    1. Compatibility
    2. Upgrading dependencies
  4. Sample App
  5. Snapshot Builds
  6. Contributing
    1. Installing
    2. License agreements
    3. Process

Usage

FirebaseUI has separate modules for using Firebase Realtime Database, Cloud Firestore, Firebase Auth, and Cloud Storage. To get started, see the individual instructions for each module:

Installation

FirebaseUI is published as a collection of libraries separated by the Firebase API they target. Each FirebaseUI library has a transitive dependency on the appropriate Firebase SDK so there is no need to include those separately in your app.

In your app/build.gradle file add a dependency on one of the FirebaseUI libraries.

dependencies {
    // FirebaseUI for Firebase Realtime Database
    implementation 'com.firebaseui:firebase-ui-database:8.0.2'

    // FirebaseUI for Cloud Firestore
    implementation 'com.firebaseui:firebase-ui-firestore:8.0.2'

    // FirebaseUI for Firebase Auth
    implementation 'com.firebaseui:firebase-ui-auth:8.0.2'

    // FirebaseUI for Cloud Storage
    implementation 'com.firebaseui:firebase-ui-storage:8.0.2'
}

If you're including the firebase-ui-auth dependency, there's a little more setup required.

After the project is synchronized, we're ready to start using Firebase functionality in our app.

Upgrading

If you are using an old version of FirebaseUI and upgrading, please see the appropriate migration guide:

Dependencies

Compatibility with Firebase / Google Play Services libraries

FirebaseUI libraries have the following transitive dependencies on the Firebase SDK:

firebase-ui-auth
|--- com.google.firebase:firebase-auth
|--- com.google.android.gms:play-services-auth

firebase-ui-database
|--- com.google.firebase:firebase-database

firebase-ui-firestore
|--- com.google.firebase:firebase-firestore

firebase-ui-storage
|--- com.google.firebase:firebase-storage

You can see the specific dependencies associated with each release on the Releases page.

Upgrading dependencies

If you would like to use a newer version of one of FirebaseUI's transitive dependencies, such as Firebase, Play services, or the Android support libraries, you need to add explicit implementation declarations in your build.gradle for all of FirebaseUI's dependencies at the version you want to use. Here are some examples listing all of the critical dependencies:

Auth

implementation "com.google.firebase:firebase-auth:$X.Y.Z"
implementation "com.google.android.gms:play-services-auth:$X.Y.Z"

implementation "androidx.lifecycle:lifecycle-extensions:$X.Y.Z"
implementation "androidx.browser:browser:$X.Y.Z"
implementation "androidx.cardview:cardview:$X.Y.Z"
implementation "androidx.constraintlayout:constraintlayout:$X.Y.Z"
implementation "androidx.legacy:legacy-support-v4:$X.Y.Z"
implementation "com.google.android.material:material:$X.Y.Z"

Firestore

implementation "com.google.firebase:firebase-firestore:$X.Y.Z"

implementation "androidx.legacy:legacy-support-v4:$X.Y.Z"
implementation "androidx.recyclerview:recyclerview:$X.Y.Z"

Realtime Database

implementation "com.google.firebase:firebase-database:$X.Y.Z"

implementation "androidx.legacy:legacy-support-v4:$X.Y.Z"
implementation "androidx.recyclerview:recyclerview:$X.Y.Z"

Storage

implementation "com.google.firebase:firebase-storage:$X.Y.Z"

implementation "androidx.legacy:legacy-support-v4:$X.Y.Z"

Sample app

There is a sample app in the app/ directory that demonstrates most of the features of FirebaseUI. Load the project in Android Studio and run it on your Android device to see a demonstration.

Before you can run the sample app, you must create a project in the Firebase console. Add an Android app to the project, and copy the generated google-services.json file into the app/ directory. Also enable anonymous authentication for the Firebase project, since some components of the sample app requires it.

If you encounter a version incompatibility error between Android Studio and Gradle while trying to run the sample app, try disabling the Instant Run feature of Android Studio. Alternatively, update Android Studio and Gradle to their latest versions.

A note on importing the project using Android Studio: Using 'Project from Version Control' will not automatically link the project with Gradle (issue #1349). When doing so and opening any build.gradle.kts file, an error shows up: Project 'FirebaseUI-Android' isn't linked with Gradle. To resolve this issue, please git checkout the project manually and import with Import from external model.

Snapshot builds

Like to live on the cutting edge? Want to try the next release of FirebaseUI before anyone else? FirebaseUI hosts "snapshot" builds on oss.jfrog.org.

Just add the following to your build.gradle:

repositories {
  maven { url "https://oss.jfrog.org/artifactory/oss-snapshot-local" }
}

Then you can depend on snapshot versions:

implementation 'com.firebaseui:firebase-ui-auth:$X.Y.Z-SNAPSHOT'

You can see which SNAPSHOT builds are avaiable here: https://oss.jfrog.org/webapp/#/artifacts/browse/tree/General/oss-snapshot-local/com/firebaseui

Snapshot builds come with absolutely no guarantees and we will close any issues asking to troubleshoot a snapshot report unless they identify a bug that should block the release launch. Experiment at your own risk!

Contributing

Installing locally

You can download FirebaseUI and install it locally by cloning this repository and running:

./gradlew :library:prepareArtifacts publishToMavenLocal

Contributor License Agreements

We'd love to accept your sample apps and patches! Before we can take them, we have to jump a couple of legal hurdles.

Please fill out either the individual or corporate Contributor License Agreement (CLA).

  • If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an individual CLA.
  • If you work for a company that wants to allow you to contribute your work, then you'll need to sign a corporate CLA.

Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we'll be able to accept your pull requests.

Contribution process

  1. Submit an issue describing your proposed change to the repo in question.
  2. The repo owner will respond to your issue promptly.
  3. If your proposed change is accepted, and you haven't already done so, sign a Contributor License Agreement (see details above).
  4. Fork the desired repo, develop, and then test your code changes on the latest dev branch.
  5. Ensure that your code adheres to the existing style of the library to which you are contributing.
  6. Ensure that your code has an appropriate set of unit tests which all pass.
  7. Submit a pull request targeting the latest dev branch.

firebaseui-android's People

Contributors

abeisgoat avatar amandle avatar asciimike avatar ashwinraghav avatar codingdoug avatar dimipaun avatar droidpulkit avatar friederbluemle avatar grimthorr avatar harshithdwivedi avatar isaisachen avatar jirungaray avatar kroikie avatar laurentiu-git avatar lsirac avatar patilshreyas avatar peterhav avatar puf avatar rosalyntan avatar ryleysill93 avatar sam-gc avatar samtstern avatar serikb avatar stephenfluin avatar supercilex avatar thatfiredev avatar ubragg avatar udaybidkar avatar williecubed avatar wuman avatar

Stargazers

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

Watchers

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

firebaseui-android's Issues

Remove Requirement for Server Client ID

The server client ID is only used to get an ID Token, which is then not used. By removing the Id Token we can remove the server client ID and simplify the setup flow (as well as the code).

NPE on .keepSynced(true);

When I try to set .keepSynced(true); I'm getting Null Pointer Exception which crash my app. Please see detailed log

Process: za.co.swarmapps.kauai, PID: 8307
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.firebase.client.snapshot.ChildKey.equals(java.lang.Object)' on a null object reference
at com.firebase.client.Query.keepSynced(Query.java:211)

compileSdkVersion 22
buildToolsVersion "23.0.0"
Library version compile 'com.firebase:firebase-client-android:2.3.1'

Login Dialog Disappears on Screen Rotation

When calling the showFirebaseLoginPrompt() method after a button click, I have the login screen open. However, when it is opened, if I rotate the device, the dialog resets to showing no providers.

I believe a fix needs to be implemented in the DialogFragment. If anybody knows an alternative workaround, let me know.

Optimize order of overridable methods in FirebaseLoginBaseActivity

The first method you typically override first when you subclass FirebaseLoginBaseActivity is getRef(). That's why we show it first in the README.

But when you tell Android Studio to implement the abstract methods, it adds them to the subclass in the order they are defined in the base class. So getRef() should be before all the other abstract methods in FirebaseLoginBaseActivity.

Get object from subclass adapter

How do i call getItem() from the mAdapter? Instead i get the getItemId() from the base Adapter class not the FirebaseRecyclerViewAdapter.

Add support for DataSnapshot as valid a model object

Currently we can't return a DataSnapshot in either Adapter, but we should be able to (for feature parity between clients as well as because some people already have custom DataSnapshot to model object conversion in place).

Login Dialog UI

Removing setEnabledAuthProvider(AuthProviderType.PASSWORD) does not remove email/password UI part. It works for other providers except password.

Remove label and allowBackup from library AndroidManifest

This is the contents of the AndroidManifest.xml file in the library folder:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.firebase.ui">
    <application android:allowBackup="true" android:label="@string/app_name">
    </application>
</manifest>

The allowBackup and label properties should be removed so they do not affect applications that include FirebaseUI.

android:allowBackup="true" causing manifest merge confilcts

Hey,

would it be possible to remove android:allowBackup="true" from the library manifest? The value should be defined in the app using the lib, not in a library. A conflict can also prevent use of this library. Is it needed in the library manifest?

Persistence between providers

New login flow returns authData for all providers, but facebook & twitter data doesn't have user email (and they often use nickname/phone as a login), so it can't be used to link google, email, fb and twitter accounts to provide seamless experience even if user logs in with different provider.
Is it possible to somehow link them and provide a unique id? (currently uid is different per provider)

Demo app does not run unmodified

I did the following:

  • git clone the repo
  • Open the app in Android Studio by doing **File > Open > FirebaseUI-Android > build.gradle`
  • Run the app by clicking Run > Run 'app'

The app displays briefly, and then crashes with the following logcat:

08-28 15:04:43.933  30224-30224/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.firebase.uidemo, PID: 30224
    java.lang.RuntimeException: java.lang.IllegalAccessException: java.lang.Class<com.firebase.uidemo.RecyclerViewDemoActivity$ChatHolder> is not accessible from java.lang.Class<com.firebase.ui.FirebaseRecyclerViewAdapter>
            at com.firebase.ui.FirebaseRecyclerViewAdapter.onCreateViewHolder(FirebaseRecyclerViewAdapter.java:174)
            at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5116)
            at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4416)
            at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4326)
            at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1955)
            at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1364)
            at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1327)
            at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:556)
            at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2713)
            at android.support.v7.widget.RecyclerView.resumeRequestLayout(RecyclerView.java:1560)
            at android.support.v7.widget.RecyclerView$1.run(RecyclerView.java:275)
            at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
            at android.view.Choreographer.doCallbacks(Choreographer.java:670)
            at android.view.Choreographer.doFrame(Choreographer.java:603)
            at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5417)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
     Caused by: java.lang.IllegalAccessException: java.lang.Class<com.firebase.uidemo.RecyclerViewDemoActivity$ChatHolder> is not accessible from java.lang.Class<com.firebase.ui.FirebaseRecyclerViewAdapter>
            at java.lang.reflect.Constructor.newInstance(Native Method)
            at com.firebase.ui.FirebaseRecyclerViewAdapter.onCreateViewHolder(FirebaseRecyclerViewAdapter.java:166)
            at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5116)
            at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4416)
            at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4326)
            at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1955)
            at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1364)
            at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1327)
            at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:556)
            at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2713)
            at android.support.v7.widget.RecyclerView.resumeRequestLayout(RecyclerView.java:1560)
            at android.support.v7.widget.RecyclerView$1.run(RecyclerView.java:275)
            at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
            at android.view.Choreographer.doCallbacks(Choreographer.java:670)
            at android.view.Choreographer.doFrame(Choreographer.java:603)
            at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5417)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Is there method available to request facebook email

Hi.

I am storing users information against their Email on Firebase. I am using this library to show Firebase Login Dialog.

However in case of Facebook i am not getting user email. I want to know if there is any helper method available in the SDK that can set permissions on the Facebook Login. If not then will it be available in future?

Thanks.

java.lang.VerifyError

I am receiving this error and have no idea why:

java.lang.VerifyError: com/firebase/ui/auth/core/FirebaseLoginDialog
                                                 at com.firebase.ui.auth.core.FirebaseLoginBaseActivity.onStart(FirebaseLoginBaseActivity.java:112)
                                                 at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1177)
                                                 at android.app.Activity.performStart(Activity.java:5551)
                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2420)
                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2507)
                                                 at android.app.ActivityThread.access$900(ActivityThread.java:172)
                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
                                                 at android.os.Handler.dispatchMessage(Handler.java:102)
                                                 at android.os.Looper.loop(Looper.java:146)
                                                 at android.app.ActivityThread.main(ActivityThread.java:5692)
                                                 at java.lang.reflect.Method.invokeNative(Native Method)
                                                 at java.lang.reflect.Method.invoke(Method.java:515)
                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
                                                 at dalvik.system.NativeStart.main(Native Method)

Support for joins

Will there be any support here for joins across multiple Firebase paths, similar to what firebase-util offers for Javascript? All of my data is denormalized, so creating a ListView just based on one path would not be sufficient. If not, do you have any recommendations?

How to partly populate a FirebaseRecyclerAdapter ?

I do need to populate a recyclerAdapter partly. I mean that some item will be removed or even not displayed ever:

Use cases:

  • give the ability to no display ever an item (e.g from item child value)
  • If a user get the possibility to discard an item.

I assume the FirebaseRecyclerAdapter is strongly link with the FB Database. I there any trick or way to do that, by getting access to the Snapshop ?

Is there any plan for clean Api on that way ?

Authenticating or Logging In

I am setting up my Facebook Login flow and am unsure if this code is redundant. Does the onFirebaseLogged in method authenticate the user or simply log them in?

@Override
protected void onFirebaseLoggedIn(AuthData authData) {
    mUserRef.authWithOAuthToken(authData.getProvider(), authData.getToken(), new Firebase.AuthResultHandler() {
        @Override
        public void onAuthenticated(AuthData authData) {
            Map<String, Object> loginMap = new HashMap<String, Object>();
            loginMap.put("email", authData.getProviderData().get("email"));
            loginMap.put("provider", authData.getProvider());
            mUserRef.child(authData.getUid()).updateChildren(loginMap);
        }

        @Override
        public void onAuthenticationError(FirebaseError firebaseError) {
            Toast.makeText(getApplicationContext(), firebaseError.getMessage(), Toast.LENGTH_LONG).show();

        }
    });


}

Allow FirebaseListAdapter class to iterate object keys

I have a scenario where I want to be able to quickly check for key existence and because of that it was desirable to use object keys as the value (like a hash table).Essentially this means I needed to be able to extend FirebaseListAdapter using a mModelClass class of type String.

To support this functionality, I modified FirebaseListAdapter with a function parseNode

private T parseNode(DataSnapshot dataSnapshot){
                String key = dataSnapshot.getKey();
                T newModel = null;
                if(!(FirebaseListAdapter.this.mModelClass == String.class)){
                    newModel = dataSnapshot.getValue(FirebaseListAdapter.this.mModelClass);
                }else{
                    newModel = (T) key;
                }
                return newModel;
            }

Now in all of the ChildEventListener callbacks the model variable gets assigned the output of parseNode and the adapter is able to handle iterating over object keys. I just figured it's a pretty minor change to the class and it helped with my case so maybe it would be useful for other people.

RecyclerView Documentation out of date

screenshot from 2016-01-07 12 41 51

There are a few problems with the section above:

  • The heading mentions FirebaseListAdapter, but that is not used.
  • The code snows FirebaseRecyclerViewAdapter, but I can only resolve FirebaseRecyclerAdapter
  • Shows usage of populateViewHolder, which my IDE says is deprecated

How to search for a value in firebase Android

I am saving data as follows in the Firebase:

screen-shot-2015-12-31-at-1 41 30-am

I want to find all records that have #Yahoo in their title. What will be the exact query for that?

I am confused with the random key created. I am not sure how to handle this so i am posting it here.

Firebase firebase = new Firebase(Constants.FIREBASE_URL_USER_TASKS).child(Utils.encodeEmail(unProcessedEmail));
        Query queryRef = firebase.orderByKey().startAt("#" + mHashTag).endAt("#" + mHashTag + "\uf8ff");

        queryRef.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                mTasksList.clear();
                mAdapter.notifyDataSetChanged();
                for (DataSnapshot task : dataSnapshot.getChildren()) {
                    mTasksList.add(task.getValue(TaskModel.class));
                }
                mAdapter.notifyItemRangeInserted(0, mTasksList.size());
                mSwipeToRefresh.post(new Runnable() {
                    @Override
                    public void run() {
                        mSwipeToRefresh.setRefreshing(false);
                    }
                });
            }

            @Override
            public void onCancelled(FirebaseError firebaseError) {
                mSwipeToRefresh.post(new Runnable() {
                    @Override
                    public void run() {
                        mSwipeToRefresh.setRefreshing(false);
                    }
                });
            }
        });

I have also posted it on SO: http://stackoverflow.com/questions/34537369/how-to-search-for-a-value-in-firebase-android

Please suggest.

Thanks.

Login with google hangs with spinner

Tried this in the emulator. Used firebase UI. Fired up the dialog, clicked the login with google button, it just hangs on a spinner. Didn't hit a breakpoint in either onXXX handlers. Just hangs. Can't find any logs from the firebase library either.

NullPointer Exception with Twitter Implementation

I have added Twitter Login to my application, however I am receiving the following error:

01-11 15:04:20.474 31823-31823/? D/AndroidRuntime: Shutting down VM
01-11 15:04:20.474 31823-31823/? W/dalvikvm: threadid=1: thread exiting
with uncaught exception (group=0x41819da0)
01-11 15:04:20.474 1181-1181/? D/WfcActivityStateReceiver: onReceive():
packageName=com.sourcey.materialloginexample, activityState=resume
01-11 15:04:20.474 31823-31823/? E/AndroidRuntime: FATAL EXCEPTION: main
Process:
com.sourcey.materialloginexample, PID: 31823

java.lang.NullPointerException at com.firebase.ui.auth.twitter.TwitterPromptActivity$1.onPostExecute(TwitterPromptActivity.java:98)
at com.firebase.ui.auth.twitter.TwitterPromptActivity$1.onPostExecute(TwitterPromptActivity.java:71)
at android.os.AsyncTask.finish(AsyncTask.java:632)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5692)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
at dalvik.system.NativeStart.main(Native Method)
01-11 15:04:20.484 767-931/? D/PointerIcon: setMouseIconStyle1 pointerType:
1001iconType:101 flag:0

Give FirebaseLoginBaseActivity a `getAuth()` method, make `onFirebaseLoggedIn()` and `onFirebaseLoggedOut()` non-abstract

The Firebase SDK allows you to call getAuth() to determine the currently authenticated user. I find myself now often overriding onFirebaseLoggedIn() and onFirebaseLoggedOut() solely to set or clear an mAuthData field.

Given how common this use-case is, the base class should contain auth data and expose it with a getAuth() method. This also means that onFirebaseLoggedIn() and onFirebaseLoggedOut() should become non-abstract. They are still useful, but many subclasses may not need them anymore.

Facebook login crashes app

Hi ! i'm trying to login on my app using facebook. When I authorize my app on facebook's app, my app pops up again but it crashes with this log:

01-04 15:59:29.423 6870-6870/com.example.rafa93br.firebase E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.rafa93br.firebase, PID: 6870

java.lang.NullPointerException: Attempt to invoke virtual method 'android.app.FragmentTransaction android.app.FragmentManager.beginTransaction()' on a null object reference
at android.app.DialogFragment.dismissInternal(DialogFragment.java:287)
at android.app.DialogFragment.dismiss(DialogFragment.java:258)
at com.firebase.ui.auth.core.FirebaseLoginDialog$1.onSuccess(FirebaseLoginDialog.java:130)
at com.firebase.ui.auth.core.FirebaseAuthProvider$1.onAuthenticated(FirebaseAuthProvider.java:33)
at com.firebase.client.authentication.AuthenticationManager$AuthAttempt$2.run(AuthenticationManager.java:90)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
01-04 16:00:33.083 6870-6870/com.example.rafa93br.firebase I/Process: Sending signal. PID: 6870 SIG: 9

Failed resolution of: Lcom/google/android/gms/auth/api/Auth;

logcat:
01-05 23:59:21.909 9529-9529/pl.kj5d.firebase1 E/AndroidRuntime: FATAL EXCEPTION: main
Process: pl.kj5d.firebase1, PID: 9529
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/auth/api/Auth;
at com.firebase.ui.auth.google.GoogleAuthProvider.(GoogleAuthProvider.java:77)
at com.firebase.ui.auth.core.FirebaseLoginDialog.setEnabledProvider(FirebaseLoginDialog.java:155)
at com.firebase.ui.auth.core.FirebaseLoginBaseActivity.setEnabledAuthProvider(FirebaseLoginBaseActivity.java:77)
at pl.kj5d.firebase1.MainActivity.onStart(01-05 23:59:21.909 9529-9529/pl.kj5d.firebase1 E/AndroidRuntime: FATAL EXCEPTION: main
Process: pl.kj5d.firebase1, PID: 9529
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/auth/api/Auth;
at com.firebase.ui.auth.google.GoogleAuthProvider.(GoogleAuthProvider.java:77)
at com.firebase.ui.auth.core.FirebaseLoginDialog.setEnabledProvider(FirebaseLoginDialog.java:155)
at com.firebase.ui.auth.core.FirebaseLoginBaseActivity.setEnabledAuthProvider(FirebaseLoginBaseActivity.java:77)
at pl.kj5d.firebase1.MainActivity.onStart(MainActivity.java:120))

Code:

MainActivity.java:120 = setEnabledAuthProvider(SocialProvider.google);

My dependencies looks like this:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
compile 'com.firebaseui:firebase-ui:0.3.0'
}

NoSuchMethodException while using FirebaseRecyclerAdapter

I am using this library to show data in RecyclerView using FirebaseRecyclerAdapter. But app is crashing with the NoSuchMethodException.

My code is:

        mAdapter = new FirebaseRecyclerAdapter<TaskModel, TaskViewHolder>(TaskModel.class, R.layout.task_list_item, TaskViewHolder.class, firebase) {
            @Override
            protected void populateViewHolder(TaskViewHolder viewHolder, TaskModel model, int position) {
                Log.i("HOME", "populateViewHolder called");
            }
        };

        mRecyclerView.setAdapter(mAdapter);

View Helper class:

class TaskViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

        private TextView mTimeTv;
        private TextView mTimeAmPm;
        private TextView mTaskTitleTv;

        private void findViews(View v) {
            mTimeTv = (TextView) v.findViewById(R.id.time_tv);
            mTimeAmPm = (TextView) v.findViewById(R.id.time_am_pm);
            mTaskTitleTv = (TextView) v.findViewById(R.id.task_title_tv);
        }

        public TaskViewHolder(View itemView) {
            super(itemView);
            findViews(itemView);
            itemView.setOnClickListener(this);
        }

        @Override
        public void onClick(View v) {

        }
    }

Please correct me if i am doing something wrong.

                                                                                 java.lang.RuntimeException: java.lang.NoSuchMethodException: <init> [class android.view.View]
                                                                                     at com.firebase.ui.FirebaseRecyclerAdapter.onCreateViewHolder(FirebaseRecyclerAdapter.java:168)
                                                                                     at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5228)
                                                                                     at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4453)
                                                                                     at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4363)
                                                                                     at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1961)
                                                                                     at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1370)
                                                                                     at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1333)
                                                                                     at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:562)
                                                                                     at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2900)
                                                                                     at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3071)
                                                                                     at android.view.View.layout(View.java:14817)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:4631)
                                                                                     at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:584)
                                                                                     at android.view.View.layout(View.java:14817)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:4631)
                                                                                     at android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1037)
                                                                                     at android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:747)
                                                                                     at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:761)
                                                                                     at android.view.View.layout(View.java:14817)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:4631)
                                                                                     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
                                                                                     at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
                                                                                     at android.view.View.layout(View.java:14817)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:4631)
                                                                                     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
                                                                                     at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
                                                                                     at android.view.View.layout(View.java:14817)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:4631)
                                                                                     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
                                                                                     at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
                                                                                     at android.view.View.layout(View.java:14817)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:4631)
                                                                                     at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1043)
                                                                                     at android.view.View.layout(View.java:14817)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:4631)
                                                                                     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
                                                                                     at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
                                                                                     at android.view.View.layout(View.java:14817)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:4631)
                                                                                     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
                                                                                     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
                                                                                     at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
                                                                                     at android.view.View.layout(View.java:14817)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:4631)
                                                                                     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
                                                                                     at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
                                                                                     at android.view.View.layout(View.java:14817)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:4631)
                                                                                     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
                                                                                     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
                                                                                     at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
                                                                                     at android.view.View.layout(View.java:14817)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:4631)
                                                                                     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
                                                                                     at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
                                                                                     at android.view.View.layout(View.java:14817)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:4631)
                                                                                     at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1983)
                                                                                    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:17

Getting Key and Priority from Java Class

I've been following the readme, and I was wondering how you can reference the Key and Priority using a Java Class

public class ChatMessage {
    String message;
    String name;

    public ChatMessage() {
    }

    public ChatMessage(String name, String message) {
        this.message = message;
        this.name = name;
    }

    public String getMessage() {
        return message;
    }

    public String getName() {
        return name;
    }
}

Google Login Not Working

I have set up all of my Google login information, and when I click on the Google button I am prompted to select a gmail / Google account. However, after I select the gmail account to use, I am receiving an error that states "user closed login dialog." Anybody experience this issue or know how to resolve?

NullPointerException on onStart

I am getting a NullPointerException when I call to super.onStart

 public class MainActivity extends FirebaseLoginBaseActivity {

Firebase mFirebaseRef;
Button mButton;
CallbackManager mFacebookCallbackManager;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Firebase.setAndroidContext(this);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    mFacebookCallbackManager = CallbackManager.Factory.create();
    mFirebaseRef = new Firebase("https://fan-polls.firebaseio.com/");
    mButton = (Button) findViewById(R.id.test_button);
    mButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            showFirebaseLoginPrompt();

        }
    });
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_main, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;
    }

    return super.onOptionsItemSelected(item);
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    mFacebookCallbackManager.onActivityResult(requestCode, resultCode, data);


}

@Override
protected void onStart() {
    super.onStart();
    setEnabledAuthProvider(SocialProvider.facebook);
}


@Override
protected void onFirebaseLoggedIn(AuthData authData) {

}

STACKTRACE

roidRuntime: FATAL EXCEPTION: main
                                               Process: com.troychuinard.firebaseui, PID: 20031
                                               java.lang.RuntimeException: Unable to start activity ComponentInfo{com.troychuinard.firebaseui/com.troychuinard.firebaseui.MainActivity}: java.lang.RuntimeException: Binary XML file line #17: You must supply a layout_height attribute.
                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2447)
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2507)
                                                   at android.app.ActivityThread.access$900(ActivityThread.java:172)
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
                                                   at android.os.Handler.dispatchMessage(Handler.java:102)
                                                   at android.os.Looper.loop(Looper.java:146)
                                                   at android.app.ActivityThread.main(ActivityThread.java:5692)
                                                   at java.lang.reflect.Method.invokeNative(Native Method)
                                                   at java.lang.reflect.Method.invoke(Method.java:515)
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
                                                   at dalvik.system.NativeStart.main(Native Method)
                                                Caused by: java.lang.RuntimeException: Binary XML file line #17: You must supply a layout_height attribute.
                                                   at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:492)
                                                   at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:6204)
                                                   at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:6372)
                                                   at android.widget.LinearLayout$LayoutParams.<init>(LinearLayout.java:1837)
                                                   at android.support.design.widget.AppBarLayout$LayoutParams.<init>(AppBarLayout.java:554)
                                                   at android.support.design.widget.AppBarLayout.generateLayoutParams(AppBarLayout.java:284)
                                                   at android.support.design.widget.AppBarLayout.generateLayoutParams(AppBarLayout.java:97)
                                                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:768)
                                                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
                                                   at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)
                                                   at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
                                                   at com.troychuinard.firebaseui.MainActivity.onCreate(MainActivity.java:32)
                                                   at android.app.Activity.performCreate(Activity.java:5541)
                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2411)
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2507) 
                                                   at android.app.ActivityThread.access$900(ActivityThread.java:172) 
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308) 
                                                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                   at android.os.Looper.loop(Looper.java:146) 
                                                   at android.app.ActivityThread.main(ActivityThread.java:5692) 
                                                   at java.lang.reflect.Method.invokeNative(Native Method) 
                                                   at java.lang.reflect.Method.invoke(Method.java:515) 
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291) 
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) 
                                                   at dalvik.system.NativeStart.main(Native Method) 
12-31 17:50:07.893 778-1276/? W/ActivityManager:   Force finishing activity               com.troychuinard.firebaseui/.MainActivity

12-31 17:50:07.903 778-20057/? W/DropBoxManagerService: Dropping: data_app_crash (2695 > 0 bytes)
12-31 17:50:07.913 1183-1183/? D/WfcActivityStateReceiver: onReceive(): packageName=com.troychuinard.firebaseui, activityState=pause
12-31 17:50:07.913 778-778/? D/CrashAnrDetector: NO DROPBOX ENTRY for :data_app_crash 1451605807918
12-31 17:50:07.913 778-921/? D/SensorService: [AR] 1.0 -3.0 9.9
12-31 17:50:07.913 778-921/? D/SensorService: ScreenOrientationSensor::Rotation Old->New [0 -> 255]
12-31 17:50:07.923 20059-20059/? I/dumpstate: begin
12-31 17:50:07.933 2720-2720/? I/SQLiteSecureOpenHelper: getWritableDatabase(pwd)
12-31 17:50:07.933 2720-2720/? I/SQLiteSecureOpenHelper: getDatabaseLocked(b,b,pwd)...
12-31 17:50:07.953 240-240/? I/SurfaceFlinger: id=677 createSurf (1x1),1 flag=4, girebaseui
12-31 17:50:08.073 240-391/? I/SurfaceFlinger: id=672 Removed Mauncher (7/12)
12-31 17:50:08.073 240-1783/? I/SurfaceFlinger: id=672 Removed Mauncher (-2/12)
12-31 17:50:08.073 2720-2720/? I/SQLiteSecureOpenHelper: getWritableDatabase(pwd)
12-31 17:50:08.073 2720-2720/? I/SQLiteSecureOpenHelper: getDatabaseLocked(b,b,pwd)...

Codelab issues

  • Step 8 and 9 are swapped

mFirebaseRef.push().setValue(new ChatMessage(MainActivity.this.mUsername, message));

should be

mFirebaseRef.push().setValue(new ChatMessage(MainActivity.this.mUsername, text));

Gradle dependency throws error

The project only syncs for version 0.1.0, but not for 0.3.0 as mentioned in the example.

dependencies {
compile 'com.firebaseui:firebase-ui:0.3.0'
}

Not able to find FirebaseLoginBaseActivity on device

I am using firebaseUI for user authentication with Google. It is running on emulator however when tried on device I am getting below exception.
Unable to find explicit activity class {com.firebase.ui.auth.core.FirebaseLoginBaseActivity} Have you defined activity in your AndroidManifest.xml

I have added firebaseui 0.3.0 in dependencies

minSdkVersion=16 in AndroidManifest.xml

Minimum SDK version set in AndroidManifest.xml is 16, though the tutorial says "Set the minimum SDK to 10 or higher."

I needed to override AndroidManifest in my project like this.

    <uses-sdk
        android:minSdkVersion="15"
        tools:overrideLibrary="com.firebase.ui"/>

Or have you left pre-16 android versions?

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.