My Android app is not syncing to the blockchain, but when I used the bitcoinj libarary on my PC it worked fine.
Note: Both programs start with walletAppKit.setBlockingStartup(false).startAsync().awaitRunning()
when the kit is complete and the app calls this on the onCreate
method and has sufficient permissions such as read/write and internet. The test device is also physical and not an emulator.
I logged both programs using
" 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()}"
Here is the logging output screenshots
You'll notice that the one with TX-IDS is running on my laptop and has a way bigger block amount than the one running on the phone, how can I get this synced up?
Use the kotlin bitcoin kit provided by horizontal systems on github. Use implementation 'com.github.horizontalsystems:bitcoin-kit-android:694d681f3e'
in your gradle module
and in your project module add mavenCentral()
in the buildscript branch:
buildscript {
repositories {
other stuff
mavenCentral()
}
dependencies {
}
}
Then in the allprojects
brackets place maven { url 'https://www.jitpack.io' }
in the repositories
brackets:
allprojects{
repositories{
*other stuff*
maven { url 'https://www.jitpack.io' }
}
}