【发布时间】:2018-02-16 17:15:44
【问题描述】:
在我的 android 应用中,我使用 Firebase Auth 程序实现了 google 登录。 如:
private void signIn() {
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, SIGNIN_CODE);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == SIGNIN_CODE) {
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
try {
// Authenicate with my Firebase
GoogleSignInAccount account = task.getResult(ApiException.class);
ProgressDialog dialog = new ProgressDialog(this); //ProgressDialog.show(this, null, "Please wait while we load sign in..", true);
dialog.setMessage("Please wait while we load sign in..");
dialog.setIndeterminate(true);
Drawable drawable = new ProgressBar(this).getIndeterminateDrawable().mutate();
drawable.setColorFilter(ContextCompat.getColor(this, R.color.progress),
PorterDuff.Mode.SRC_IN);
dialog.setIndeterminateDrawable(drawable);
dialog.show();
firebaseAuthWithGoogle(account);
} catch (ApiException e) {
// Google Sign In failed?
Log.w(TAG, "Google sign in failed", e);
}
}
} //A lot more stuffs etc etc..
我已经有一个 SQlite 离线数据库。现在仅适用于登录用户,我希望用户可以将 SQlite 数据库的内容与 firebase 数据库同步,用户可以稍后在线访问/同步。
但是如何为具有 UID 等的个人登录用户组织单个 firebase 数据库?
更具体的建议/教程会很好:)
【问题讨论】:
标签: android firebase firebase-realtime-database firebase-authentication