當前位置: 首頁>>代碼示例>>Java>>正文


Java FirebaseAuth.getInstance方法代碼示例

本文整理匯總了Java中com.google.firebase.auth.FirebaseAuth.getInstance方法的典型用法代碼示例。如果您正苦於以下問題:Java FirebaseAuth.getInstance方法的具體用法?Java FirebaseAuth.getInstance怎麽用?Java FirebaseAuth.getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.firebase.auth.FirebaseAuth的用法示例。


在下文中一共展示了FirebaseAuth.getInstance方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreateView

import com.google.firebase.auth.FirebaseAuth; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_journal_list, container, false);

    // Set the adapter
    if (view instanceof RecyclerView) {
        FirebaseDatabase dbRef = FirebaseDatabase.getInstance();
        FirebaseAuth auth = FirebaseAuth.getInstance();
        FirebaseUser user = auth.getCurrentUser();
        DatabaseReference userRef = dbRef.getReference(user.getUid());
        userRef.addChildEventListener (chEvListener);
        userRef.addValueEventListener(valEvListener);
        Context context = view.getContext();
        RecyclerView recyclerView = (RecyclerView) view;
        if (mColumnCount <= 1) {
            recyclerView.setLayoutManager(new LinearLayoutManager(context));
        } else {
            recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount));
        }
        adapter = new JournalAdapter(allTrips, mListener);
        recyclerView.setAdapter(adapter);
    }
    return view;
}
 
開發者ID:gvsucis,項目名稱:mobile-app-dev-book,代碼行數:26,代碼來源:JournalFragment.java

示例2: sendEmailVerification

import com.google.firebase.auth.FirebaseAuth; //導入方法依賴的package包/類
public void sendEmailVerification() {
    // [START send_email_verification]
    FirebaseAuth auth = FirebaseAuth.getInstance();
    FirebaseUser user = auth.getCurrentUser();

    user.sendEmailVerification()
            .addOnCompleteListener(new OnCompleteListener<Void>() {
                @Override
                public void onComplete(@NonNull Task<Void> task) {
                    if (task.isSuccessful()) {
                        Log.d(TAG, "Email sent.");
                    }
                }
            });
    // [END send_email_verification]
}
 
開發者ID:firebase,項目名稱:snippets-android,代碼行數:17,代碼來源:MainActivity.java

示例3: onCreate

import com.google.firebase.auth.FirebaseAuth; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sign_in);

    // Initialize FirebaseAuth
    mFirebaseAuth = FirebaseAuth.getInstance();

    // Assign fields
    mSignInButton = (SignInButton) findViewById(R.id.sign_in_button);

    // Set click listeners
    mSignInButton.setOnClickListener(this);

    // Configure Google Sign In
    GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestIdToken(getString(R.string.default_web_client_id))
            .requestEmail()
            .build();
    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
            .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
            .build();

    // Initialize FirebaseAuth
}
 
開發者ID:miemiekismet,項目名稱:IdleCat,代碼行數:27,代碼來源:SignInActivity.java

示例4: onCreate

import com.google.firebase.auth.FirebaseAuth; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.AppTheme);
    super.onCreate(savedInstanceState);
    counter =0;
    mAuth = FirebaseAuth.getInstance();
    databaseFamilies = FirebaseDatabase.getInstance().getReference("Families");
    setContentView(R.layout.activity_app_login);
    Button mEmailSignInButton = (Button) findViewById(R.id.email_sign_in_button);
    //Signs in user with Google sign in
    mEmailSignInButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            // Check if user is signed in (non-null)
            FirebaseUser currentUser = mAuth.getCurrentUser();
            // Add user to database
            startActivityForResult(
                    AuthUI.getInstance()
                            .createSignInIntentBuilder()
                            .setAvailableProviders(providers)
                            .build(),
                    RC_SIGN_IN);
        }
    });
}
 
開發者ID:TranAlan,項目名稱:Chore-Manager-App,代碼行數:26,代碼來源:AppLoginActivity.java

示例5: onCreate

import com.google.firebase.auth.FirebaseAuth; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Initialize Firebase Auth
    mFirebaseAuth = FirebaseAuth.getInstance();
    mFirebaseUser = mFirebaseAuth.getCurrentUser();
    if (mFirebaseUser != null) {
        mUsername = mFirebaseUser.getDisplayName();
        mUID = mFirebaseUser.getUid();
        Intent intent = new Intent(this, DisplayCatActivity.class);
        intent.putExtra(USERNAME, mUsername);
        intent.putExtra(USERID, mUID);
        startActivity(intent);
    }
}
 
開發者ID:miemiekismet,項目名稱:IdleCat,代碼行數:18,代碼來源:MainActivity.java

示例6: onCreate

import com.google.firebase.auth.FirebaseAuth; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //setContentView(R.layout.activity_home);
    setContentView(R.layout.fragment_feed);
    Log.d(TAG, "onCreate: starting");

    setupBottomNavigationBar();
    mAuth = FirebaseAuth.getInstance();
    mDatabase = FirebaseDatabase.getInstance();

    mFeed = findViewById(R.id.myFeed);
    Log.d(TAG, mFeed.toString());
    listAdapter = new MainFeedListAdapter(HomeActivity.this, R.layout.layout_feed_list_item, posts);
    mFeed.setAdapter(listAdapter);
    downloadMyFeed();
}
 
開發者ID:sindhu732,項目名稱:instagram_clone,代碼行數:18,代碼來源:HomeActivity.java

示例7: startSession

import com.google.firebase.auth.FirebaseAuth; //導入方法依賴的package包/類
protected void startSession() {
    Log.i("scan.log", "Init database session" );
    final ScannerDao scannerDao = new ScannerDao( this.context );

    this.auth = FirebaseAuth.getInstance();
    FirebaseUser currentUser = this.auth.getCurrentUser();
    if( currentUser == null ) {
        Log.i("scan.log", "No Has User connerct" );
        this.auth.signInWithEmailAndPassword( "[email protected]", "123456" )
                .addOnCompleteListener( new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        if( task.isSuccessful() ) {
                            initDataBase( scannerDao );
                        }
                    }
                });
    } else {
        Log.i("scan.log", "Has user connected" );
        this.initDataBase( scannerDao );
    }
}
 
開發者ID:tec-ustp,項目名稱:SIIEScanner,代碼行數:23,代碼來源:FirebaseScanner.java

示例8: onCreate

import com.google.firebase.auth.FirebaseAuth; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    setContentView(R.layout.activity_registration);
    auth = FirebaseAuth.getInstance();
    appStatus=new AppStatus(getApplicationContext());
    register = (Button) findViewById(R.id.btn_register);
    existinguser = (Button) findViewById(R.id.existinguser);
    edt_Password = (EditText) findViewById(R.id.edt_Rpassword);
    edt_RePassword = (EditText) findViewById(R.id.edt_RRepassword);
    edt_Email = (EditText) findViewById(R.id.edt_email);
    progressBar=(ProgressBar)findViewById(R.id.progressBar);
    register.setOnClickListener(this);
    existinguser.setOnClickListener(this);
}
 
開發者ID:Pritom14,項目名稱:Password-Storage,代碼行數:17,代碼來源:RegistrationActivity.java

示例9: onCreate

import com.google.firebase.auth.FirebaseAuth; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sign_up);
    ButterKnife.bind(this);
    setSupportActionBar(toolbar);
    mAuth = FirebaseAuth.getInstance();
    shake = AnimationUtils.loadAnimation(this, R.anim.shake);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
 
開發者ID:gvsucis,項目名稱:mobile-app-dev-book,代碼行數:11,代碼來源:SignUpActivity.java

示例10: onCreate

import com.google.firebase.auth.FirebaseAuth; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {

    if (!calledAlready) {
        FirebaseDatabase.getInstance().setPersistenceEnabled(true);
        calledAlready = true;
    }

    super.onCreate(savedInstanceState);
    // Initialize Firebase Auth and Database Reference
    mFirebaseAuth = FirebaseAuth.getInstance();
    mFirebaseUser = mFirebaseAuth.getCurrentUser();

    if (mFirebaseUser!= null) {
        startActivity(new Intent(this, MainActivity.class));
        finish();
    }

    setContentView(R.layout.activity_welcome);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    // Not logged in, Therefore remain.
    ImageView welcomeLogo = (ImageView) findViewById(R.id.welcome_logo);
    Button logInButton = (Button) findViewById(R.id.loginButton);
    Button signInButton = (Button) findViewById(R.id.signinButton);

    Glide.with(this).load(R.drawable.ic_web)
            .placeholder(R.drawable.ic_web)
            .into(welcomeLogo);

    logInButton.setOnClickListener(this);
    signInButton.setOnClickListener(this);
}
 
開發者ID:OlayinkaPeter,項目名稱:Toodoo,代碼行數:35,代碼來源:Welcome.java

示例11: onCreate

import com.google.firebase.auth.FirebaseAuth; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    setContentView(R.layout.activity_login);
    splashActivity=new SplashActivity();
    prop=new Properties();
    auth = FirebaseAuth.getInstance();
    appStatus=new AppStatus(getApplicationContext());
    str_getEmail = SplashActivity.sh.getString("email", null);
    str_getPass = SplashActivity.sh.getString("password", null);
    login = (Button) findViewById(R.id.btn_login);
    newuser = (Button) findViewById(R.id.newuser);
    edt_Email = (EditText) findViewById(R.id.edt_email);
    edt_Password = (EditText) findViewById(R.id.edt_password);
    progressBar=(ProgressBar)findViewById(R.id.progressBar);
    b=splashActivity.containsPass("password");
    if(b==true){
    }
    login.setOnClickListener(this);
    newuser.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(new Intent(LoginActivity.this,RegistrationActivity.class));
        }
    });
}
 
開發者ID:Pritom14,項目名稱:Password-Storage,代碼行數:28,代碼來源:LoginActivity.java

示例12: onCreate

import com.google.firebase.auth.FirebaseAuth; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sign_in);
    ActionBar actionBar = getSupportActionBar();
    sharedPreferences = getApplicationContext().getSharedPreferences("event_me", Context.MODE_PRIVATE);
    if(actionBar!=null)
        actionBar.hide();
    GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestIdToken(getString(R.string.api_client_id))
            .requestEmail()
            .build();
    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
            .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
            .build();
    signInButton = (SignInButton)findViewById(R.id.sign_in_button);
    signInButton.setOnClickListener(this);
    mAuth = FirebaseAuth.getInstance();
    mAuthListener = new FirebaseAuth.AuthStateListener() {
        @Override
        public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            FirebaseUser user = firebaseAuth.getCurrentUser();
            if (user != null) {
                // User is signed in
                Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid());
            } else {
                // User is signed out
                Log.d(TAG, "onAuthStateChanged:signed_out");
            }
        }
    };
    mDatabase = FirebaseDatabase.getInstance().getReference();
}
 
開發者ID:picopalette,項目名稱:event-me,代碼行數:35,代碼來源:SignInActivity.java

示例13: onCreate

import com.google.firebase.auth.FirebaseAuth; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_new_journal);
    ButterKnife.bind(this);

    Intent data = getIntent();
    if (data.hasExtra("TRIP")) {
        toolbar.setTitle("Edit Journal");
        Parcelable par = data.getParcelableExtra("TRIP");
        currentTrip = Parcels.unwrap(par);
        FirebaseAuth auth = FirebaseAuth.getInstance();
        String uid = auth.getCurrentUser().getUid();
        DatabaseReference ref = FirebaseDatabase.getInstance()
                .getReference(uid).child(currentTrip.getKey())
                .child("entries");
        photoFrag = PhotoFragment.newInstance(ref.toString());
        getSupportFragmentManager().beginTransaction()
                .add(R.id.container, photoFrag)
                .commit();
        jname.setText(currentTrip.getName());
        location.setText(currentTrip.getLocation());
        startDateView.setText(formatted(DateTime.parse(currentTrip
                .getStartDate())));
        endDateView.setText(formatted(DateTime.parse(currentTrip.getEndDate())));
        startDate = DateTime.parse(currentTrip.getStartDate());
        endDate = DateTime.parse(currentTrip.getEndDate());
    } else {
        toolbar.setTitle("New Journal");
        currentTrip = new Trip();
        DateTime today = DateTime.now();
        startDateView.setText(formatted(today));
        endDateView.setText(formatted(today.plusDays(1)));
        startDate = today;
        endDate = today.plusDays(1);
    }
    dpDialog = DatePickerDialog.newInstance(this,
            startDate.getYear(), startDate.getMonthOfYear() - 1, startDate
                    .getDayOfMonth());

    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

}
 
開發者ID:gvsucis,項目名稱:mobile-app-dev-book,代碼行數:45,代碼來源:TripEditorActivity.java

示例14: provideFirebaseAuth

import com.google.firebase.auth.FirebaseAuth; //導入方法依賴的package包/類
@Provides
@Singleton
FirebaseAuth provideFirebaseAuth() {
    return FirebaseAuth.getInstance();
}
 
開發者ID:sztomek,項目名稱:cleanarchitecture-unidirectional,代碼行數:6,代碼來源:ApiModule.java

示例15: AuthSourceImpl

import com.google.firebase.auth.FirebaseAuth; //導入方法依賴的package包/類
AuthSourceImpl() {
    this.mFirebaseAuth = FirebaseAuth.getInstance();
}
 
開發者ID:VidyaSastry,項目名稱:Opal-Chat-AnalyticsDashboard,代碼行數:4,代碼來源:AuthSourceImpl.java


注:本文中的com.google.firebase.auth.FirebaseAuth.getInstance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。