I am having a problem, and I'm sure it's just because I'm a beginner.
I am building an app and I want to use the FirebaseUI for logging my users in to the app. Followed the guide in the readme file, and everything looks nice, except an error saying "missing return statement" in this:
@Override
public Firebase getFirebaseRef() {
// TODO: Return your Firebase ref
}
I really don't know what to do with this, and I have searched everywhere for an answer. I cant figure out what the Firebase ref is, and what to do with it. Can anybody point me in the right direction? I'm shure it's just my inexperience in coding, but I try to learn as I go. What i really want this to do is pop up the login screen when app is started, and when login is complete, send the user to the HomeActivity.
My complete MainActivity.java:
public class MainActivity extends FirebaseLoginBaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
showFirebaseLoginPrompt();
}
@Override
public Firebase getFirebaseRef() {
// TODO: Return your Firebase ref
}
@Override
public void onFirebaseLoginProviderError(FirebaseLoginError firebaseError) {
// TODO: Handle an error from the authentication provider
}
@Override
public void onFirebaseLoginUserError(FirebaseLoginError firebaseError) {
// TODO: Handle an error from the user
}
@Override
public void onFirebaseLoggedIn(AuthData authData) {
// TODO: Handle successful login
Intent intent = new Intent(this, HomeActivity.class);
startActivity(intent);
}
@Override
public void onFirebaseLoggedOut() {
// TODO: Handle logout
}
@Override
protected void onStart() {
super.onStart();
// All providers are optional! Remove any you don't want.
setEnabledAuthProvider(AuthProviderType.FACEBOOK);
setEnabledAuthProvider(AuthProviderType.GOOGLE);
}
}
I know it's probably a stupid question, but as I said, I'm a beginner.
Try:
@Override
public Firebase getFirebaseRef() {
// TODO: Return your Firebase ref
Firebase ref = new Firebase("https://YOUR_APP.firebaseio.com");
return ref;
}
Write your app name instead of YOUR_APP.
I also recommend: Firebase Quickstart Guide