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


Java FirebaseCrash類代碼示例

本文整理匯總了Java中com.google.firebase.crash.FirebaseCrash的典型用法代碼示例。如果您正苦於以下問題:Java FirebaseCrash類的具體用法?Java FirebaseCrash怎麽用?Java FirebaseCrash使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: onOptionsItemSelected

import com.google.firebase.crash.FirebaseCrash; //導入依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.invite_menu:
            sendInvitation();
            return true;
        case R.id.crash_menu:
            FirebaseCrash.logcat(Log.ERROR, TAG, "crash caused");
            causeCrash();
            return true;
        case R.id.sign_out_menu:
            mFirebaseAuth.signOut();
            Auth.GoogleSignInApi.signOut(mGoogleApiClient);
            mFirebaseUser = null;
            mUsername = ANONYMOUS;
            mPhotoUrl = null;
            startActivity(new Intent(this, SignInActivity.class));
            finish();
            return true;
        case R.id.fresh_config_menu:
            fetchConfig();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
開發者ID:firebase,項目名稱:friendlychat-android,代碼行數:27,代碼來源:MainActivity.java

示例2: refreshChange

import com.google.firebase.crash.FirebaseCrash; //導入依賴的package包/類
@SuppressWarnings("ResultOfMethodCallIgnored")
private List<Observable<TrainHeader>> refreshChange(Map<Pair<String, String>, String> info) {
    List<Observable<TrainHeader>> o = new LinkedList<>();
    for (Pair<String, String> p : info.keySet()) {
        try {
            Integer.parseInt(p.first);
            Integer.parseInt(p.second);
            Integer.parseInt(info.get(p));
        } catch (NumberFormatException e) {
            view.showSnackbar("Problema di aggiornamento", ENUM_SNACKBAR_ACTIONS.NONE, Snackbar.LENGTH_SHORT);
            Log.e("refreshChange: ", "There are problems with these parameters:", p.first, p.second, info.get(p));
            FirebaseCrash.report(new Exception(("REFRESH CHANGE ERROR There are problems with these parameters:" + p.first + " " + p.second + " " + info.get(p))));
            continue;
        }

        o.add(APINetworkingFactory.createRetrofitService(JourneyService.class)
                .getDelay(p.first,
                        p.second,
                        info.get(p))
                .observeOn(AndroidSchedulers.mainThread()));
    }
    return o;
}
 
開發者ID:albertogiunta,項目名稱:justintrain-client-android,代碼行數:24,代碼來源:JourneyResultsPresenter.java

示例3: setNickNameToUI

import com.google.firebase.crash.FirebaseCrash; //導入依賴的package包/類
private void setNickNameToUI(DatabaseReference databaseReference, FirebaseUser firebaseUser) {
    databaseReference.child("users")
            .child(firebaseUser.getUid())
            .addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot) {
                    // Update the android UI
                    setNickNameToUI(dataSnapshot.getValue(User.class).getNickName());
                }

                @Override
                public void onCancelled(DatabaseError databaseError) {
                    Log.e(TAG, "Database Error Occurred", databaseError.toException());
                    FirebaseCrash.report(databaseError.toException());
                }
            });
}
 
開發者ID:moizalicious,項目名稱:Forager,代碼行數:18,代碼來源:AccountSettings.java

示例4: setNumberOfMushroomsToUI

import com.google.firebase.crash.FirebaseCrash; //導入依賴的package包/類
private void setNumberOfMushroomsToUI(DatabaseReference databaseReference, FirebaseUser firebaseUser) {
    databaseReference.child("users")
            .child(firebaseUser.getUid())
            .addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot) {
                    // Update the android UI
                    setNumberOfMushroomsToUI(dataSnapshot.getValue(User.class).getNumberOfMushrooms());
                }

                @Override
                public void onCancelled(DatabaseError databaseError) {
                    Log.e(TAG, "Database Error Occurred", databaseError.toException());
                    FirebaseCrash.report(databaseError.toException());
                }
            });
}
 
開發者ID:moizalicious,項目名稱:Forager,代碼行數:18,代碼來源:AccountSettings.java

示例5: setNumberOfPointsToUI

import com.google.firebase.crash.FirebaseCrash; //導入依賴的package包/類
private void setNumberOfPointsToUI(DatabaseReference databaseReference, FirebaseUser firebaseUser) {
    databaseReference.child("users")
            .child(firebaseUser.getUid())
            .addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot) {
                    // Update the android UI
                    setNumberOfPointsToUI(dataSnapshot.getValue(User.class).getNumberOfPoints());
                }

                @Override
                public void onCancelled(DatabaseError databaseError) {
                    Log.e(TAG, "Database Error Occurred", databaseError.toException());
                    FirebaseCrash.report(databaseError.toException());
                }
            });
}
 
開發者ID:moizalicious,項目名稱:Forager,代碼行數:18,代碼來源:AccountSettings.java

示例6: setDistanceRemainingToUI

import com.google.firebase.crash.FirebaseCrash; //導入依賴的package包/類
private void setDistanceRemainingToUI(final DatabaseReference databaseReference, FirebaseUser firebaseUser) {
    databaseReference.child("global")
            .child("distanceRemaining")
            .addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot) {
                    // Update the android UI
                    setDistanceRemainingToUI(dataSnapshot.getValue(Long.class).intValue());
                }

                @Override
                public void onCancelled(DatabaseError databaseError) {
                    Log.e(TAG, "Database Error Occurred", databaseError.toException());
                    FirebaseCrash.report(databaseError.toException());
                }
            });
}
 
開發者ID:moizalicious,項目名稱:Forager,代碼行數:18,代碼來源:Community.java

示例7: subtractFromDistanceRemaining

import com.google.firebase.crash.FirebaseCrash; //導入依賴的package包/類
private void subtractFromDistanceRemaining(final DatabaseReference databaseReference, FirebaseUser firebaseUser) {
    databaseReference.child("global")
            .child("distanceRemaining")
            .addListenerForSingleValueEvent(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot) {
                    // Update the database
                    subtractFromDistanceRemaining(databaseReference, (dataSnapshot.getValue(Long.class).intValue() - 1));
                }

                @Override
                public void onCancelled(DatabaseError databaseError) {
                    Log.e(TAG, "Database Error Occurred", databaseError.toException());
                    FirebaseCrash.report(databaseError.toException());
                }
            });
}
 
開發者ID:moizalicious,項目名稱:Forager,代碼行數:18,代碼來源:StartGame.java

示例8: addMushroomToDatabase

import com.google.firebase.crash.FirebaseCrash; //導入依賴的package包/類
private void addMushroomToDatabase(final DatabaseReference databaseReference, final FirebaseUser firebaseUser) {
    databaseReference.child("users")
            .child(firebaseUser.getUid())
            .addListenerForSingleValueEvent(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot) {
                    // Update the cloud database
                    addMushroomToDatabase(databaseReference, firebaseUser, (dataSnapshot.getValue(User.class).getNumberOfMushrooms() + 1));
                }

                @Override
                public void onCancelled(DatabaseError databaseError) {
                    Log.e(TAG, "Database Error Occurred", databaseError.toException());
                    FirebaseCrash.report(databaseError.toException());
                }
            });
}
 
開發者ID:moizalicious,項目名稱:Forager,代碼行數:18,代碼來源:StartGame.java

示例9: addPointToDatabase

import com.google.firebase.crash.FirebaseCrash; //導入依賴的package包/類
private void addPointToDatabase(final DatabaseReference databaseReference, final FirebaseUser firebaseUser) {
    databaseReference.child("users")
            .child(firebaseUser.getUid())
            .addListenerForSingleValueEvent(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot) {
                    // Update the cloud database
                    addPointToDatabase(databaseReference, firebaseUser, (dataSnapshot.getValue(User.class).getNumberOfPoints() + 1));
                }

                @Override
                public void onCancelled(DatabaseError databaseError) {
                    Log.e(TAG, "Database Error Occurred", databaseError.toException());
                    FirebaseCrash.report(databaseError.toException());
                }
            });
}
 
開發者ID:moizalicious,項目名稱:Forager,代碼行數:18,代碼來源:StartGame.java

示例10: testIfAppUpdateIsRequired

import com.google.firebase.crash.FirebaseCrash; //導入依賴的package包/類
private void testIfAppUpdateIsRequired() {
    firebaseRemoteConfig.fetch()
            .addOnCompleteListener(this, new OnCompleteListener<Void>() {
                @Override
                public void onComplete(@NonNull Task<Void> task) {
                    if (task.isSuccessful()) {
                        firebaseRemoteConfig.activateFetched();
                    } else {
                        FirebaseCrash.report(task.getException());
                    }

                    if (firebaseRemoteConfig.getBoolean(Constants.APP_UPDATE_KEY)) {
                        showUpdateDialog();
                    } else {
                        startActivity(new Intent(PreChecksActivity.this, NavigationDrawerActivity.class));
                        finish();
                    }
                }
            });
}
 
開發者ID:Protino,項目名稱:CodeWatch,代碼行數:21,代碼來源:PreChecksActivity.java

示例11: fetchAccessToken

import com.google.firebase.crash.FirebaseCrash; //導入依賴的package包/類
private void fetchAccessToken(Intent intent) {
    Uri uri = intent.getData();
    String code = uri.getQueryParameter("code");
    String state = uri.getQueryParameter("state");
    originalHashState = sharedPreferences.getString(PREF_CODE_STATE, null);
    if (code != null && state != null && state.equals(originalHashState)) {
        if (state.equals(originalHashState)) {
            SharedPreferences.Editor sharedPreferencesEditor = sharedPreferences.edit();
            sharedPreferencesEditor.putString(PREF_ACCESS_CODE, code);
            sharedPreferencesEditor.apply();
            requestAccessToken(code);
        } else {
            FirebaseCrash.log("Invalid state received. Possible security attack");
            EventBus.getDefault().postSticky(loginEvent.setLoginSuccess(false));
            finish();
        }
    } else {
        FirebaseCrash.log("No access_code received");
        EventBus.getDefault().postSticky(loginEvent.setLoginSuccess(false));
        finish();
    }
}
 
開發者ID:Protino,項目名稱:CodeWatch,代碼行數:23,代碼來源:LoginActivity.java

示例12: onPostExecute

import com.google.firebase.crash.FirebaseCrash; //導入依賴的package包/類
@Override
protected void onPostExecute(@Constants.ErrorCodes Integer result) {
    if (swipeRefreshLayout != null) {
        swipeRefreshLayout.setRefreshing(false);
    }
    switch (result) {
        case INTERNET_OFF:
            showSnackBar(R.string.internet_error_message);
            break;
        case STATS_UPDATING:
            showSnackBar(R.string.stats_updating_error_message);
            break;
        case UNKNOWN_ERROR:
            FirebaseCrash.log("Unknown error occurred while fetching stats - error code" + UNKNOWN_ERROR);
            break;
        default:
            break;
    }
}
 
開發者ID:Protino,項目名稱:CodeWatch,代碼行數:20,代碼來源:DashboardFragment.java

示例13: firebaseAuthWithGoogle

import com.google.firebase.crash.FirebaseCrash; //導入依賴的package包/類
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
    Log.d(TAG, "firebaseAuthWithGooogle:" + acct.getId());
    AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
    showProgressDialog(getString(R.string.profile_progress_message));
    mAuth.signInWithCredential(credential)
            .addOnSuccessListener(this, new OnSuccessListener<AuthResult>() {
                @Override
                public void onSuccess(AuthResult result) {
                    handleFirebaseAuthResult(result);
                }
            })
            .addOnFailureListener(this, new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception e) {
                    FirebaseCrash.logcat(Log.ERROR, TAG, "auth:onFailure:" + e.getMessage());
                    handleFirebaseAuthResult(null);
                }
            });
}
 
開發者ID:firebase,項目名稱:friendlypix-android,代碼行數:20,代碼來源:ProfileActivity.java

示例14: handleGoogleSignInResult

import com.google.firebase.crash.FirebaseCrash; //導入依賴的package包/類
@DebugLog
void handleGoogleSignInResult(GoogleSignInResult result) {
    if (result.isSuccess()) {
        // Successful Google sign in, authenticate with Firebase.
        GoogleSignInAccount acct = result.getSignInAccount();
        firebaseAuthWithGoogle(acct);
    } else {
        // Unsuccessful Google Sign In, show signed-out UI
        Timber.e("Google Sign-In failed.");
        Timber.e("status code : " + result.getStatus().getStatusCode());
        Timber.e(result.getStatus().getStatusMessage());
        String error = "Google Sign-In failed. status code : " +
                result.getStatus().getStatusCode() + " . reason: " +
                result.getStatus().getStatusMessage();
        Toast.makeText(this, error, Toast.LENGTH_SHORT).show();
        FirebaseCrash.log(error);
    }
}
 
開發者ID:hbmartin,項目名稱:firebase-chat-android-architecture-components,代碼行數:19,代碼來源:ProfileActivity.java

示例15: createService

import com.google.firebase.crash.FirebaseCrash; //導入依賴的package包/類
/**
 * Method returns a Call<S> to perform retrofit operations on
 * Should be called in an Async Task/Thread to avoid network calls on main thread exceptions
 * <br/>
 * @param serviceClass Any interface with @Call<T> return types
 * @param mContext Usual context object
 * <br/>
 * @return Retrofit Class from the serviceClass param
 */
public static <S> S createService(@NonNull Class<S> serviceClass, Context mContext) {
    try {
        if ((mToken = TokenReference.getInstance()) == null || mToken.getExpires() < (System.currentTimeMillis()/1000L))
            mToken = new TokenReference(mContext).reInitInstance();
        if(httpClient.interceptors().size() < 1) {
            httpClient.addInterceptor(new AuthInterceptor());
        }
    } catch (Exception e) {
        FirebaseCrash.report(e);
        e.printStackTrace();
    }
    if(ani_ret == null)
        ani_ret = builder.client(httpClient.build()).build();
    return ani_ret.create(serviceClass);
}
 
開發者ID:wax911,項目名稱:anitrend-app,代碼行數:25,代碼來源:ServiceGenerator.java


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