android – When downloading the blockchain my software is change into unusable, is there a difficulty with my code or am I utilizing the BitcoinJ library incorrectly?

0
65


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 reveals that you want to obtain the blockchain nevertheless.

When making an attempt to obtain the blockchain to view the stability of my pockets, it begins to lock up and change into unusable. I’ve even tried downloading the blockchain in an async job like so, however nonetheless the app turns into utterly unusable and the UI does not even load. What am I lacking? I assumed that the obtain would not be that giant as I’m making an attempt to create an SPV pockets which from what I perceive does not obtain your entire blockchain, or is that this one thing I must 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(consequence: String?) {
            tremendous.onPostExecute(consequence)
            Globals.peerGroup?.stopAsync()
            Globals.pockets?.saveToFile(Globals.walletFile)
        }
     }
 }

LEAVE A REPLY

Please enter your comment!
Please enter your name here