当前位置: 首页>>代码示例>>Java>>正文


Java WalletAppKit.setDownloadListener方法代码示例

本文整理汇总了Java中org.bitcoinj.kits.WalletAppKit.setDownloadListener方法的典型用法代码示例。如果您正苦于以下问题:Java WalletAppKit.setDownloadListener方法的具体用法?Java WalletAppKit.setDownloadListener怎么用?Java WalletAppKit.setDownloadListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bitcoinj.kits.WalletAppKit的用法示例。


在下文中一共展示了WalletAppKit.setDownloadListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startDownload

import org.bitcoinj.kits.WalletAppKit; //导入方法依赖的package包/类
public void startDownload() {
    BriefLogFormatter.init();
    String filePrefix = "voting-wallet";
    File walletFile = new File(Environment.getExternalStorageDirectory() + "/" + Util.FOLDER_DIGITAL_VOTING_PASS);
    if (!walletFile.exists()) {
        walletFile.mkdirs();
    }
    kit = new WalletAppKit(params, walletFile, filePrefix);

    //set the observer
    kit.setDownloadListener(progressTracker);

    kit.setBlockingStartup(false);

    PeerAddress peer = new PeerAddress(params, peeraddr);
    kit.setPeerNodes(peer);
    kit.startAsync();
}
 
开发者ID:digital-voting-pass,项目名称:polling-station-app,代码行数:19,代码来源:BlockChain.java

示例2: initWalletService

import org.bitcoinj.kits.WalletAppKit; //导入方法依赖的package包/类
private void initWalletService() {
    Log.d(TAG, "initWalletService with app config: " + getAppConfig());

    ClientUtils.fixECKeyComparator();
    initLogging();

    bitcoinjContext = new Context(getNetworkParameters());
    Context.propagate(bitcoinjContext);



    walletFile = walletFile();
    Log.d(TAG, "Wallet file: " + walletFile + ", already exists: " + walletFile.exists());
    kit = new WalletAppKit(bitcoinjContext, getFilesDir(), getAppConfig().getWalletFilesPrefix()) {
        @Override
        protected void onSetupCompleted() {
            final long startTime = System.currentTimeMillis();
            try {
                wallet = kit.wallet();
                peerGroup = kit.peerGroup();
                blockChain = kit.chain();
                blockStore = kit.store();



                initWalletEventListener();

                /*
                 * Check that we already have keys.
                 * - if yes: check whether current address is still locked. if no: create new one.
                 * - if no: (1) create client key, (2) execute key-exchange and store server key (3) init address
                 */
                boolean keysAlreadyExist = loadKeysIfExist();
                if (!keysAlreadyExist) {
                    keyExchange();
                    loadKeysIfExist();
                }

                initAddresses();
                initFiatCurrency();

                // broadcast current wallet balance (not using serviceBinder!)
                Coin coinBalance = wallet.getBalance();
                broadcastBalanceChanged(coinBalance, exchangeRate.coinToFiat(coinBalance));

                if(walletLRunnable!=null) {
                    walletLRunnable.run();
                }
                appKitInitDone = true;
                broadcastBalanceChanged();
            } catch (Exception e) {
                String errorMessage = "Error during wallet initialization: " + e.getMessage();
                Log.e(TAG, errorMessage, e);
                broadcastWalletError(errorMessage);
            } finally {
                long duration = System.currentTimeMillis() - startTime;
                Log.d(TAG, "WalletService - onSetupCompleted finished in "+duration+" ms");
            }
        }
    };

    setChainCheckpoints();
    kit.setDownloadListener(new DownloadListener());
    kit.setBlockingStartup(false);
    kit.startAsync();

    Log.d(TAG, "Wallet started");
}
 
开发者ID:coinblesk,项目名称:coinblesk-client-gui,代码行数:69,代码来源:WalletService.java


注:本文中的org.bitcoinj.kits.WalletAppKit.setDownloadListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。