我的 Android 应用程序没有同步到区块链,但是当我在我的 PC 上使用 bitcoinj 库时,它运行良好。注意:这两个程序都是walletAppKit.setBlockingStartup(false).startAsync().awaitRunning()
在套件完成并且应用程序在onCreate
方法上调用它并且具有足够的权限(例如读/写和互联网)时开始的。测试设备也是物理的,而不是仿真器。我使用记录了这两个程序
" File Directory:${walletAppKit.directory()}\nTransactions:\n"
try {
for(x in walletAppKit.wallet().transactionsByTime){
str+="${x.txId}\n"
}
str+="Peer # and running:${walletAppKit.peerGroup().numConnectedPeers()} ${walletAppKit.peerGroup().isRunning}\n"
str+="Chain Height: ${walletAppKit.chain().chainHead.height}\n"
str+="Balance: ${walletAppKit.wallet().balance.toPlainString() } BTC Received: ${walletAppKit.wallet().totalReceived.toPlainString() } BTC Sent: ${walletAppKit.wallet().totalSent.toPlainString() } BTC\n"
str+="Directory Status: ${walletAppKit.directory().totalSpace} bytes\n Can Read File?:${walletAppKit.directory().canRead()} Can Write File?:${walletAppKit.directory().canWrite()}"
您会注意到带有 TX-IDS 的那个在我的笔记本电脑上运行,并且比在手机上运行的那个具有更大的块数量,我怎样才能让它同步?