• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java FirebaseException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.firebase.client.FirebaseException的典型用法代码示例。如果您正苦于以下问题:Java FirebaseException类的具体用法?Java FirebaseException怎么用?Java FirebaseException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FirebaseException类属于com.firebase.client包,在下文中一共展示了FirebaseException类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onFirebaseException

import com.firebase.client.FirebaseException; //导入依赖的package包/类
private <T> void onFirebaseException(Exception error, Task<T>.TaskCompletionSource taskSource,
                                     TaskProvider<T> taskProvider) {
    FirebaseException firebaseException = (FirebaseException) error;
    boolean permissionDenied = firebaseException.getMessage().contains("Permission denied");

    if (permissionDenied) {
        codementorTasks.extractAppData()
                .onSuccessTask(task -> authenticate(task.getResult(), true))
                .continueWith(task -> {
                    if (task.isCancelled() || task.isFaulted()) {
                        taskSource.setError(error);
                    } else {
                        taskProvider.get().continueWith(this.<T>onWrappedTaskReCompleted(taskSource));
                    }

                    return null;
                });
    } else {
        taskSource.setError(error);
    }
}
 
开发者ID:aluxian,项目名称:Codementor,代码行数:22,代码来源:FirebaseTasks.java


示例2: observe

import com.firebase.client.FirebaseException; //导入依赖的package包/类
public static Observable<DataSnapshot> observe(final Query ref) {

        return Observable.create(new Observable.OnSubscribe<DataSnapshot>() {

            @Override
            public void call(final Subscriber<? super DataSnapshot> subscriber) {
                final ValueEventListener listener = ref.addValueEventListener(new ValueEventListener() {
                    @Override
                    public void onDataChange(DataSnapshot dataSnapshot) {
                        subscriber.onNext(dataSnapshot);
                    }

                    @Override
                    public void onCancelled(FirebaseError error) {
                        // Turn the FirebaseError into a throwable to conform to the API
                        subscriber.onError(new FirebaseException(error.getMessage()));
                    }
                });

                // When the subscription is cancelled, remove the listener
                subscriber.add(Subscriptions.create(() -> ref.removeEventListener(listener)));
            }
        });
    }
 
开发者ID:zetbaitsu,项目名称:Sigap,代码行数:25,代码来源:RxFirebase.java


示例3: observeOnce

import com.firebase.client.FirebaseException; //导入依赖的package包/类
public static Observable<DataSnapshot> observeOnce(final Query ref) {

        return Observable.create(new Observable.OnSubscribe<DataSnapshot>() {

            @Override
            public void call(final Subscriber<? super DataSnapshot> subscriber) {
                ref.addListenerForSingleValueEvent(new ValueEventListener() {
                    @Override
                    public void onDataChange(DataSnapshot dataSnapshot) {
                        subscriber.onNext(dataSnapshot);
                        subscriber.onCompleted();
                    }

                    @Override
                    public void onCancelled(FirebaseError error) {
                        // Turn the FirebaseError into a throwable to conform to the API
                        subscriber.onError(new FirebaseException(error.getMessage()));
                        subscriber.onCompleted();
                    }
                });
            }
        });
    }
 
开发者ID:zetbaitsu,项目名称:Sigap,代码行数:24,代码来源:RxFirebase.java


示例4: authenticate

import com.firebase.client.FirebaseException; //导入依赖的package包/类
@Override
public AuthData authenticate(Firebase firebase) throws FirebaseException, InterruptedException {
  final CountDownLatch done = new CountDownLatch(1);
  firebase.authWithPassword(this.email, this.password, new AuthResultHandler() {
    @Override
    public void onAuthenticationError(FirebaseError err) {
      done.countDown();
      throw err.toException();
    }
    @Override
    public void onAuthenticated(AuthData arg0) {
      result = arg0;
      done.countDown();
    }
  });
  done.await();
  return result;
}
 
开发者ID:fhoffa,项目名称:bqpipeline,代码行数:19,代码来源:FirebasePasswordAuthenticator.java


示例5: onWrappedTaskCompleted

import com.firebase.client.FirebaseException; //导入依赖的package包/类
private <T> Continuation<T, T> onWrappedTaskCompleted(Task<T>.TaskCompletionSource taskSource,
                                                      TaskProvider<T> taskProvider) {
    return task -> {
        Exception error = task.getError();

        if (task.isCancelled()) {
            if (error != null) {
                throw new CancellationException(error.getMessage());
            } else {
                throw new CancellationException();
            }
        }

        if (task.isFaulted()) {
            if (error instanceof FirebaseException) {
                this.<T>onFirebaseException(error, taskSource, taskProvider);
            } else {
                taskSource.setError(error);
            }

            return null;
        }

        taskSource.setResult(task.getResult());
        return null;
    };
}
 
开发者ID:aluxian,项目名称:Codementor,代码行数:28,代码来源:FirebaseTasks.java


示例6: push

import com.firebase.client.FirebaseException; //导入依赖的package包/类
public void push(ThunderBoardSensor sensor) {

        try {
            long time = System.currentTimeMillis();
            Timber.d("%d: %s", time, sensor.getSensorData().toString());
            data.put(time, sensor.getSensorData().clone());
        } catch (FirebaseException e) {
            e.printStackTrace();
            Timber.d(e.getMessage());
        }
    }
 
开发者ID:SiliconLabs,项目名称:thunderboard-android,代码行数:12,代码来源:CloudManager.java


示例7: createFirebaseReference

import com.firebase.client.FirebaseException; //导入依赖的package包/类
/**
 * Creates all firebase references for the current session.
 *
 * @param model
 * @param deviceName
 * @param uniqueID
 * @param demo
 * @param sensor
 * @return
 */
public String createFirebaseReference(String model, String deviceName, String uniqueID, String demo, ThunderBoardSensor sensor) {

    try {

        long currentTime = System.currentTimeMillis();

        String rootDataThundeBoardSessionsUrl = String.format("%s%s/sessions", baseDataThunderBoardUrl, model);
        Timber.d("rootDataThundeBoardSessionsUrl: %s", rootDataThundeBoardSessionsUrl);
        rootDataThundeBoardSessionsReference = new Firebase(rootDataThundeBoardSessionsUrl);
        rootDataThundeBoardSessionsReference.authWithCustomToken(keyFirebase, this);

        String rootDataSessionsUrl = String.format("%s%s", baseDataSessionsUrl, uniqueID);
        Timber.d("rootDataSessionsUrl: %s", rootDataSessionsUrl);
        rootDataSessionsReference = new Firebase(rootDataSessionsUrl);
        rootDataSessionsReference.authWithCustomToken(keyFirebase, this);
        rootDataSessionsDemoReference = rootDataSessionsReference.child(demo);

        // push the start time
        rootDataSessionsReference.child(START_TIME).setValue(currentTime);
        rootDataSessionsReference.child(TEMPERATURE_TYPE).setValue(prefsManager.getPreferences().temperatureType);
        rootDataSessionsReference.child(MEASUREMENTS_TYPE).setValue(prefsManager.getPreferences().measureUnitType);
        Timber.d("root sessions ref: %s", rootDataSessionsReference.getPath().toString());

        // push contactInfo
        ContactInfo ci = new ContactInfo();
        ThunderBoardPreferences prefs = prefsManager.getPreferences();
        ci.emailAddress = prefs.userEmail;
        ci.fullName = prefs.userName;
        ci.title = prefs.userTitle;
        ci.phoneNumber = prefs.userPhone;
        ci.deviceName = deviceName;
        rootDataSessionsReference.child("contactInfo").setValue(ci);

        String demoUrl = String.format("%s%s/%s/%s", baseDemoSessionsUrl, model, uniqueID, demo);
        Timber.d("short demo url: %s", demoUrl);
        rootDataSessionsReference.child(SHORT_URL).setValue(demoUrl);
        // will be overriden later, we do not want to keep it null....
        // if the requirement is to use a short url, then a refactor is needed to wait until it's available
        shortUrl = demoUrl;

        data = new HashMap<>();

        push(sensor);

        pushTimer.start();

        // request in the background
        shortenUrlReference = rootDataSessionsReference;
        shortenUrl(demoUrl);

        rootDataThundeBoardSessionsReference.child(String.valueOf(currentTime)).setValue(uniqueID);

        return demoUrl;

    } catch (FirebaseException e) {
        e.printStackTrace();
        Timber.d(e.getMessage());
        return null;
    }
}
 
开发者ID:SiliconLabs,项目名称:thunderboard-android,代码行数:71,代码来源:CloudManager.java


示例8: authenticate

import com.firebase.client.FirebaseException; //导入依赖的package包/类
public abstract AuthData authenticate(Firebase firebase)
throws FirebaseException, InterruptedException;
 
开发者ID:fhoffa,项目名称:bqpipeline,代码行数:3,代码来源:FirebaseAuthenticator.java


示例9: authenticate

import com.firebase.client.FirebaseException; //导入依赖的package包/类
@Override
public AuthData authenticate(Firebase firebase) throws FirebaseException {
  return new AuthData(null, 0, null, null, null, null);
}
 
开发者ID:fhoffa,项目名称:bqpipeline,代码行数:5,代码来源:FirebaseEmptyAuthenticator.java



注:本文中的com.firebase.client.FirebaseException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AccessOutputMeta类代码示例发布时间:2022-05-22
下一篇:
Java BusinessCalendar类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap