gpt4 book ai didi

android - Banch onInitFinished 即使在超时后也没有被调用

转载 作者:行者123 更新时间:2023-11-29 15:39:40 24 4
gpt4 key购买 nike

 Branch branch = Branch.getInstance();
branch.setRetryCount(1);
branch.setRetryInterval(10);
branch.initSession(new Branch.BranchUniversalReferralInitListener() {
@Override
public void onInitFinished(BranchUniversalObject branchUniversalObject, LinkProperties linkProperties, BranchError branchError) {

我的onInitFinished有时在用户网速慢的时候不被调用。我已经看到该应用程序在尝试初始化分支时卡住了超过 30 秒

最佳答案

来自 Branch 的 Alex:

这是目前已知的边缘情况。我们正在努力修复,但现在您可以像下面这样实现超时:

final CountDownLatch countDownLatch = new CountDownLatch(1);
new Thread(new Runnable() {
@Override
public void run() {
branch.initSession(new Branch.BranchUniversalReferralInitListener() {
@Override
public void onInitFinished(BranchUniversalObject branchUniversalObject, LinkProperties linkProperties, BranchError error) {
if(countDownLatch.getCount() > 0) {
countDownLatch.countDown();
postBranchInitSession(null);
}
}
});
try {
countDownLatch.await(5000, TimeUnit.MICROSECONDS);
} catch (InterruptedException ignore) {
postBranchInitSession(null);
}
}

}).run();

关于android - Banch onInitFinished 即使在超时后也没有被调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42852550/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com