I’m constructing a Bitcoin pockets with the BitcoinJ Library, after trying on the instance of fetching a transaction that they’ve proven on their github it exhibits that it’s essential obtain the blockchain nonetheless.
When trying to obtain the blockchain to view the stability of my pockets, it begins to lock up and turn out to be unusable. I’ve even tried downloading the blockchain in an async process like so, however nonetheless the app turns into fully unusable and the UI does not even load. What am I lacking? I believed that the obtain would not be that giant as I’m trying to create an SPV pockets which from what I perceive does not obtain all the blockchain, or is that this one thing I have to configure seperately?
class MainActivity : AppCompatActivity() {
override enjoyable onCreate(savedInstanceState: Bundle?) {
DownloadBlockchain().execute()
}
interior class DownloadBlockchain : AsyncTask<Void, Int, String>() {
override enjoyable doInBackground(vararg p0: Void?): String {
Globals.peerGroup?.startAsync()
Globals.peerGroup?.downloadBlockChain()
return "full"
}
override enjoyable onPostExecute(outcome: String?) {
tremendous.onPostExecute(outcome)
Globals.peerGroup?.stopAsync()
Globals.pockets?.saveToFile(Globals.walletFile)
}
}
}