当前位置: 首页>>代码示例>>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;未经允许,请勿转载。