本文整理汇总了Java中com.google.firebase.database.DatabaseError.toException方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseError.toException方法的具体用法?Java DatabaseError.toException怎么用?Java DatabaseError.toException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.firebase.database.DatabaseError
的用法示例。
在下文中一共展示了DatabaseError.toException方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDataListener
import com.google.firebase.database.DatabaseError; //导入方法依赖的package包/类
private ValueEventListener createDataListener() {
return new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
if (dataSnapshot.hasChild(Integer.toString(remoteOpponentSeqNum))) {
DataSnapshot newCheckPointData = dataSnapshot.child(Integer.toString(remoteOpponentSeqNum));
remoteOpponentSeqNum++;
CheckPoint newCheckPoint = new CheckPoint(
((double)newCheckPointData.child(FirebaseNodes.LATITUDE).getValue()),
((double)newCheckPointData.child(FirebaseNodes.LONGITUDE).getValue()));
callbackHandler.hasNewData(newCheckPoint);
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
throw databaseError.toException();
}
};
}
示例2: createReadyListener
import com.google.firebase.database.DatabaseError; //导入方法依赖的package包/类
private ValueEventListener createReadyListener() {
return new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
if(firstReadyCallback) {
firstReadyCallback = false;
} else {
callbackHandler.isReady();
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
throw databaseError.toException();
}
};
}
示例3: createFinishedListener
import com.google.firebase.database.DatabaseError; //导入方法依赖的package包/类
private ValueEventListener createFinishedListener() {
return new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
if(firstFinishedCallback) {
firstFinishedCallback = false;
} else {
callbackHandler.isFinished();
remoteOpponentFinished = true;
if (localUserFinished) {
removeActiveListeners();
firebaseHelper.deleteChallengeNode(challengeName);
isChallengeTerminated = true;
}
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
throw databaseError.toException();
}
};
}
示例4: createAbortListener
import com.google.firebase.database.DatabaseError; //导入方法依赖的package包/类
private ValueEventListener createAbortListener() {
return new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
if(firstAbortCallback) {
firstAbortCallback = false;
} else {
removeActiveListeners();
isChallengeTerminated = true;
deleteChallenge();
callbackHandler.hasLeft();
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
throw databaseError.toException();
}
};
}
示例5: createInRoomListener
import com.google.firebase.database.DatabaseError; //导入方法依赖的package包/类
private ValueEventListener createInRoomListener() {
return new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if(firstInRoomCallback) {
firstInRoomCallback = false;
} else {
callbackHandler.opponentInRoom();
firebaseHelper.removeUserChallengeListener(challengeName, remoteOpponent, inRoomListener, FirebaseNodes.ChallengeStatus.IN_ROOM);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
throw databaseError.toException();
}
};
}