本文整理汇总了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);
}
}
示例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;
}
示例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());
}
});
}
示例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());
}
});
}
示例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());
}
});
}
示例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());
}
});
}
示例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());
}
});
}
示例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());
}
});
}
示例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());
}
});
}
示例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();
}
}
});
}
示例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();
}
}
示例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;
}
}
示例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);
}
});
}
示例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);
}
}
示例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);
}