com.google.firebase.crash.FirebaseCrash Java Examples

The following examples show how to use com.google.firebase.crash.FirebaseCrash. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DownloadHandler.java    From OneTapVideoDownload with GNU General Public License v3.0 6 votes vote down vote up
private void handleLocalFileDownload(String url, final File file) {
    final File sourceFile = new File(url);
    if (!sourceFile.exists()) {
        Toast.makeText(mContext, R.string.link_expired_download_again, Toast.LENGTH_LONG).show();
        setStatus(DownloadInfo.Status.NetworkProblem);
        writeToDatabase();
        return;
    }

    mDownloadInfo.setContentLength(sourceFile.length());

    new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                BufferedSource bufferedSource = Okio.buffer(Okio.source(sourceFile));
                bufferedSource.skip(mDownloadInfo.getDownloadedLength());
                BufferedSink bufferedSink = Okio.buffer(Okio.appendingSink(file));
                writeData(bufferedSource, bufferedSink);
            } catch (Exception e) {
                FirebaseCrash.report(e);
                e.printStackTrace();
            }
        }
    }).start();
}
 
Example #2
Source File: GithubRemoteDataSource.java    From gito-github-client with Apache License 2.0 6 votes vote down vote up
@WorkerThread
private Views getRepositoryViewsSync(final Repository repository, String period) {
    try {
        Views views = GitHubAPI.traffic()
                .setToken(getToken())
                .setTokenType(getTokenType())
                .setRepository(repository)
                .setPeriod(period)
                .getViews();

        mLocalDataSource.saveViews(repository.getId(), views);
        return views;

    } catch (IOException e) {
        if (Utils.isNetworkAvailable()) {
            FirebaseCrash.report(e);
        }
        return null;
    }
}
 
Example #3
Source File: GithubRemoteDataSource.java    From gito-github-client with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unused")
@WorkerThread
private List<ReferringSite> getRepositoryReferrersSync(final Repository repository) {
    try {
        List<ReferringSite> referringSites = GitHubAPI.traffic()
                .setToken(getToken())
                .setTokenType(getTokenType())
                .setRepository(repository)
                .getReferringSites();
        mLocalDataSource.saveReferringSites(repository.getId(), referringSites);
        return referringSites;
    } catch (IOException e) {
        if (Utils.isNetworkAvailable()) {
            FirebaseCrash.report(e);
        }
        return null;
    }
}
 
Example #4
Source File: VimeoUriChecker.java    From OneTapVideoDownload with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Video checkUrl(String url) {
    if (!url.contains("player.vimeo.com")) {
        return null;
    }

    try {
        String vimeoConfig = Global.getResponseBody(url);
        JSONObject json = new JSONObject(vimeoConfig);
        String videoUrl = json.getJSONObject("request")
                .getJSONObject("files")
                .getJSONArray("progressive")
                .getJSONObject(0)
                .getString("url");

        if (videoUrl != null && !videoUrl.isEmpty()) {
            return new BrowserVideo(videoUrl);
        }
    } catch (Exception e) {
        FirebaseCrash.report(e);
        e.printStackTrace();
    }

    return null;
}
 
Example #5
Source File: GithubRemoteDataSource.java    From gito-github-client with Apache License 2.0 6 votes vote down vote up
@WorkerThread
private List<Star> getStargazersSync(Repository repository) {
    try {
        List<Star> stars = GitHubAPI.stargazers()
                .setToken(getToken())
                .setTokenType(getTokenType())
                .setRepository(repository)
                .setPage(Service.Pagination.LAST_PAGE)
                .setDate(Utils.twoWeeksAgo())
                .getStars();
        mLocalDataSource.saveStargazers(repository, stars);
        return stars;
    } catch (IOException e) {
        if (Utils.isNetworkAvailable()) {
            FirebaseCrash.report(e);
        }
        return null;
    }
}
 
Example #6
Source File: Global.java    From OneTapVideoDownload with GNU General Public License v3.0 6 votes vote down vote up
public static String getResponseBody(String url) {
    try {
        Request request = new Request.Builder()
                .url(url)
                .build();

        OkHttpClient client = new OkHttpClient();
        Response response = client.newCall(request).execute();
        if (response.body().contentLength() < 3*1000*1000L) {
            return response.body().string();
        } else {
            throw new IllegalArgumentException("Body content size is very large");
        }
    } catch (Exception e) {
        FirebaseCrash.report(e);
        e.printStackTrace();
        return null;
    }
}
 
Example #7
Source File: ApplicationUpdateNotification.java    From OneTapVideoDownload with GNU General Public License v3.0 5 votes vote down vote up
private int installedApplicationVersion() {
    try {
        PackageInfo pInfo = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0);
        return pInfo.versionCode;
    } catch (PackageManager.NameNotFoundException e) {
        FirebaseCrash.report(e);
        e.printStackTrace();
        return -1;
    }
}
 
Example #8
Source File: Fa.java    From justaline-android with Apache License 2.0 5 votes vote down vote up
/**
 * Send a caught exception to Firebase with an additional logged message
 */
public void exception(Throwable throwable, String logMessage) {
    Log.e(TAG, "Exception: " + throwable + " | " + logMessage, throwable);
    if (BuildConfig.DEBUG) {
        return;
    }

    FirebaseCrash.logcat(Log.WARN, TAG, logMessage);
    FirebaseCrash.report(throwable);
}
 
Example #9
Source File: Global.java    From OneTapVideoDownload with GNU General Public License v3.0 5 votes vote down vote up
public static String readFileToString(File file) {
    String result = null;
    try {
        FileInputStream fis = new FileInputStream(file);
        byte[] data = new byte[(int) file.length()];
        fis.read(data);
        fis.close();

        result = new String(data, "UTF-8");
    } catch (IOException e) {
        FirebaseCrash.report(e);
        e.printStackTrace();
    }
    return result;
}
 
Example #10
Source File: ApplicationUpdateNotification.java    From OneTapVideoDownload with GNU General Public License v3.0 5 votes vote down vote up
private int latestApplicationVersion(@NonNull JSONObject jsonObject) {
    try {
        return jsonObject.getInt("latest_version_code");
    } catch (JSONException e) {
        FirebaseCrash.report(e);
        e.printStackTrace();
        return 0;
    }
}
 
Example #11
Source File: ApplicationUpdateNotification.java    From OneTapVideoDownload with GNU General Public License v3.0 5 votes vote down vote up
private String getDownloadUrl(@NonNull JSONObject jsonObject) {
    try {
        return jsonObject.getString("latest_version_url");
    } catch (JSONException e) {
        FirebaseCrash.report(e);
        e.printStackTrace();
        return null;
    }
}
 
Example #12
Source File: DownloadViewHolder.java    From OneTapVideoDownload with GNU General Public License v3.0 5 votes vote down vote up
void setProgress(int progress) {
    mProgressBar.setProgress(progress);
    try {
        mPercentageTextView.setText(String.format(Locale.getDefault(), "%d%%", progress));
    } catch (Exception e) {
        FirebaseCrash.report(e);
        e.printStackTrace();
    }
}
 
Example #13
Source File: DownloadViewHolder.java    From OneTapVideoDownload with GNU General Public License v3.0 5 votes vote down vote up
void setDownloadUrl(String url) {
    try {
        mDownloadUrl.setText(URLDecoder.decode(url, "UTF-8").replace("%20", " "));
    } catch (Exception e) {
        FirebaseCrash.report(e);
        e.printStackTrace();
    } finally {
        mDownloadUrl.setText(url.replace("%20", " "));
    }
}
 
Example #14
Source File: Log.java    From android-galaxyzoo with GNU General Public License v3.0 5 votes vote down vote up
public static void error(final String message) {
    if(android.util.Log.isLoggable(LOG_TAG, android.util.Log.ERROR)) {
        android.util.Log.e(LOG_TAG, defaultString(message));

        FirebaseCrash.log(defaultString(message));
    }
}
 
Example #15
Source File: HookClassNamesFetcher.java    From OneTapVideoDownload with GNU General Public License v3.0 5 votes vote down vote up
protected String doInBackground(String... urls) {
    try {
        return Global.getResponseBody(mHookUrl);
    } catch (Exception e) {
        FirebaseCrash.report(e);
        e.printStackTrace();
    }
    return null;
}
 
Example #16
Source File: Log.java    From android-galaxyzoo with GNU General Public License v3.0 5 votes vote down vote up
public static void error(final String message, final Throwable e) {
    if(android.util.Log.isLoggable(LOG_TAG, android.util.Log.ERROR)) {
        android.util.Log.e(LOG_TAG, defaultString(message), e);

        FirebaseCrash.log(defaultString(message));
    }
}
 
Example #17
Source File: TrafficFragment.java    From gito-github-client with Apache License 2.0 5 votes vote down vote up
@Override
public void openUrl(String url) {
    try {
        Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        getActivity().startActivity(browserIntent);
    } catch (ActivityNotFoundException e) {
        FirebaseCrash.report(e);
    }
}
 
Example #18
Source File: GithubLocalDataSource.java    From gito-github-client with Apache License 2.0 5 votes vote down vote up
public void saveTrendingRepositories(String period, String language,
                                     List<TrendingRepository> repositories) {
    Uri uri = TrendingContract.TrendingEntry.CONTENT_URI;

    ArrayList<ContentProviderOperation> ops = new ArrayList<>();

    ops.add(ContentProviderOperation.newDelete(uri)
            .withSelection(TrendingContract.TrendingEntry.COLUMN_LANGUAGE + " = ? AND " +
                            TrendingContract.TrendingEntry.COLUMN_PERIOD + " = ? ",
                    new String[]{language, period}).build());

    for (TrendingRepository repository : repositories) {

        repository.setLanguage(language);
        repository.setPeriod(period);

        ContentValues contentValues = TrendingContract.TrendingEntry
                .buildContentValues(repository, period, language);
        ops.add(ContentProviderOperation.newInsert(uri)
                .withValues(contentValues).build());
    }
    try {
        mContentResolver.applyBatch(TrendingContract.CONTENT_AUTHORITY, ops);
        mContentResolver.notifyChange(uri, null);
    } catch (RemoteException | OperationApplicationException e) {
        FirebaseCrash.report(e);
    }
}
 
Example #19
Source File: ConversationsHandler.java    From chat21-android-sdk with GNU Affero General Public License v3.0 5 votes vote down vote up
public void toggleConversationRead(final String recipientId) {

        // retrieve the conversation by the conversationId
        Conversation conversation = getById(recipientId);

        // toggle the conversation status
        boolean status = !conversation.getIs_new();

        if (conversation != null) {
            final boolean finalStatus = status;
            conversationsNode.addListenerForSingleValueEvent(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot snapshot) {
                    // check if the conversation exists to prevent conversation with only "is_new" value
                    if (snapshot.hasChild(recipientId)) {
                        // update the state
                        conversationsNode.child(recipientId)
                                .child("is_new")
                                .setValue(finalStatus);
                    }
                }

                @Override
                public void onCancelled(DatabaseError databaseError) {
                    String errorMessage = "cannot toggle the conversation read: " +
                            databaseError.getMessage();
                    Log.e(TAG, errorMessage);
                    FirebaseCrash.report(new Exception(errorMessage));
                }
            });
        }
    }
 
Example #20
Source File: ConversationsHandler.java    From chat21-android-sdk with GNU Affero General Public License v3.0 5 votes vote down vote up
public void setConversationRead(final String recipientId) {
    Log.d(TAG, "setConversationRead");

    Conversation conversation = getById(recipientId);
    // check if the conversation is new
    // if it is new set the conversation as read (false), do nothing otherwise
    if (conversation != null && conversation.getIs_new()) {
        conversationsNode.addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot snapshot) {
                // check if the conversation exists to prevent conversation with only "is_new" value
                if (snapshot.hasChild(recipientId)) {
                    // update the state
                    conversationsNode.child(recipientId)
                            .child("is_new")
                            .setValue(false); // the conversation has been read
                }
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {
                String errorMessage = "cannot mark the conversation as read: " +
                        databaseError.getMessage();
                Log.e(TAG, errorMessage);
                FirebaseCrash.report(new Exception(errorMessage));
            }
        });
    }
}
 
Example #21
Source File: ArchivedConversationsHandler.java    From chat21-android-sdk with GNU Affero General Public License v3.0 5 votes vote down vote up
public void toggleConversationRead(final String recipientId) {

        // retrieve the conversation by the conversationId
        Conversation conversation = getById(recipientId);

        // toggle the conversation status
        boolean status = !conversation.getIs_new();

        if (conversation != null) {
            final boolean finalStatus = status;
            conversationsNode.addListenerForSingleValueEvent(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot snapshot) {
                    // check if the conversation exists to prevent conversation with only "is_new" value
                    if (snapshot.hasChild(recipientId)) {
                        // update the state
                        conversationsNode.child(recipientId)
                                .child("is_new")
                                .setValue(finalStatus);
                    }
                }

                @Override
                public void onCancelled(DatabaseError databaseError) {
                    String errorMessage = "cannot toggle the conversation read: " +
                            databaseError.getMessage();
                    Log.e(TAG, errorMessage);
                    FirebaseCrash.report(new Exception(errorMessage));
                }
            });
        }
    }
 
Example #22
Source File: ArchivedConversationsHandler.java    From chat21-android-sdk with GNU Affero General Public License v3.0 5 votes vote down vote up
public void setConversationRead(final String recipientId) {
    Log.d(TAG, "setConversationRead");

    Conversation conversation = getById(recipientId);
    // check if the conversation is new
    // if it is new set the conversation as read (false), do nothing otherwise
    if (conversation != null && conversation.getIs_new()) {
        conversationsNode.addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot snapshot) {
                // check if the conversation exists to prevent conversation with only "is_new" value
                if (snapshot.hasChild(recipientId)) {
                    // update the state
                    conversationsNode.child(recipientId)
                            .child("is_new")
                            .setValue(false); // the conversation has been read
                }
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {
                String errorMessage = "cannot mark the conversation as read: " +
                        databaseError.getMessage();
                Log.e(TAG, errorMessage);
                FirebaseCrash.report(new Exception(errorMessage));
            }
        });
    }
}
 
Example #23
Source File: ChatAuthentication.java    From chat21-android-sdk with GNU Affero General Public License v3.0 5 votes vote down vote up
private void updateUserProfile(final String displayName, Uri userPhotoUri) {
    Log.d(DEBUG_LOGIN, "updateUserProfile: displayName == " + displayName
            + ", userPhotoUri == " + userPhotoUri);

    final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();

    if (StringUtils.isValid(displayName)) {
        UserProfileChangeRequest.Builder builder = new UserProfileChangeRequest.Builder()
                .setDisplayName(displayName);

        if (userPhotoUri != null)
            builder.setPhotoUri(userPhotoUri);

        UserProfileChangeRequest profileUpdates = builder.build();

        user.updateProfile(profileUpdates).addOnCompleteListener(new OnCompleteListener<Void>() {
            @Override
            public void onComplete(@NonNull Task<Void> task) {
                Log.d(DEBUG_LOGIN, "updateUserProfile.onCompleteSuccess");

                if (task.isSuccessful()) {
                    Log.i(DEBUG_LOGIN, "User profile (" + displayName + ")" +
                            " updated with success for user with uid: " + user.getUid());
                    isUserProfileUpdated = true;
                } else {
                    task.getException().printStackTrace();

                    String errorMessage = "updateUserProfile.onCompleteError: "
                            + task.getException().getMessage();
                    Log.e(DEBUG_LOGIN, errorMessage);
                    FirebaseCrash.report(new Exception(errorMessage));
                }
            }
        });
    }
}
 
Example #24
Source File: ChatAuthentication.java    From chat21-android-sdk with GNU Affero General Public License v3.0 5 votes vote down vote up
private void updateUserEmail(final String email) {
    Log.d(DEBUG_LOGIN, "updateUserEmail");

    if (StringUtils.isValid(email)) {
        final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();

        user.updateEmail(email).addOnCompleteListener(new OnCompleteListener<Void>() {
            @Override
            public void onComplete(@NonNull Task<Void> task) {
                Log.d(DEBUG_LOGIN, "updateUserEmail.onCompleteSuccess");

                if (task.isSuccessful()) {
                    Log.i(DEBUG_LOGIN, "User email address (" + email + ") " +
                            "updated with success for user with uid: " + user.getUid());
                    isEmailUpdated = true;
                } else {
                    task.getException().printStackTrace();

                    String errorMessage = "updateUserEmail.onCompleteError: "
                            + task.getException().getMessage();
                    Log.e(DEBUG_LOGIN, errorMessage);
                    FirebaseCrash.report(new Exception(errorMessage));
                }
            }
        });
    }
}
 
Example #25
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public void restoreFromBlockByXPRV2(String xprv, Runnable callback) {
    xprv = xprv.trim();
    try {
        DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params);
        String privhex = dk01.getPrivateKeyAsHex();
        ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex));
        KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent());
        kcg.importKeys(ecKey001);
        wallet = new Wallet(params, kcg);
        sharedManager.setLastSyncedBlock(Coders.encodeBase64(xprv));
        walletFriendlyAddress = wallet.currentReceiveAddress().toString();
        xprvKey = xprv;
    } catch (IllegalArgumentException iae) {
        FirebaseCrash.report(iae);
        Log.e("psd", "restoreFromBlockByXPRV2: " + iae.toString());
        callback.run();
        return;
    }

    callback.run();

    RequestorBtc.getUTXOListBch(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() {
        @Override
        public void onSuccess(Object response) {
            List<UTXOItem> utxos = (List<UTXOItem>)response;
            setUTXO(utxos);
        }

        @Override
        public void onFailure(String msg) {

        }
    });
}
 
Example #26
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public void restoreFromBlockByXPRV(String xprv, WalletCreationCallback callback) {
    xprv = xprv.trim();
    try {
        DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params);
        String privhex = dk01.getPrivateKeyAsHex();
        ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex));
        KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent());
        kcg.importKeys(ecKey001);
        wallet = new Wallet(params, kcg);
        walletFriendlyAddress = wallet.currentReceiveAddress().toString();
        xprvKey = xprv;
    } catch (IllegalArgumentException iae) {
        FirebaseCrash.report(iae);
        Log.e("psd", "restoreFromBlockByXPRV: " + iae.toString());
        callback.onWalletCreated(wallet);
        return;
    }

    callback.onWalletCreated(wallet);

    RequestorBtc.getUTXOListBch(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() {
        @Override
        public void onSuccess(Object response) {
            List<UTXOItem> utxos = (List<UTXOItem>)response;
            setUTXO(utxos);
        }

        @Override
        public void onFailure(String msg) {

        }
    });
}
 
Example #27
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public void restoreFromBlockByWif2(String wif, Runnable callback) {
    wif = wif.trim();
    try {
        DumpedPrivateKey dumpedPrivateKey = DumpedPrivateKey.fromBase58(params, wif);
        ECKey key = dumpedPrivateKey.getKey();
        wallet = new Wallet(params);
        wallet.importKey(key);
        restFromWif = true;
        sharedManager.setLastSyncedBlock(Coders.encodeBase64(wif));
        walletFriendlyAddress = wallet.getImportedKeys().get(0).toAddress(params).toString();
        wifKey = wif;
    } catch (WrongNetworkException wne) {
        Log.e("psd", "restoreFromBlockByWif2: " + wne.toString());
        callback.run();
        return;
    } catch (IllegalArgumentException iae) {
        FirebaseCrash.report(iae);
        Log.e("psd", "restoreFromBlockByWif2: " + iae.toString());
        callback.run();
        return;
    }

    callback.run();

    RequestorBtc.getUTXOListBch(walletFriendlyAddress, new ApiMethods.RequestListener() {
        @Override
        public void onSuccess(Object response) {
            List<UTXOItem> utxos = (List<UTXOItem>)response;
            setUTXO(utxos);
        }

        @Override
        public void onFailure(String msg) {

        }
    });
}
 
Example #28
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public void restoreFromBlockByXPRV2(String xprv, Runnable callback) {
    xprv = xprv.trim();
    try {
        DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params);
        String privhex = dk01.getPrivateKeyAsHex();
        ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex));
        KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent());
        kcg.importKeys(ecKey001);
        wallet = new Wallet(params, kcg);
        sharedManager.setLastSyncedBlock(Coders.encodeBase64(xprv));
        walletFriendlyAddress = wallet.currentReceiveAddress().toString();
        xprvKey = xprv;
    } catch (IllegalArgumentException iae) {
        FirebaseCrash.report(iae);
        Log.e("psd", "restoreFromBlockByXPRV2: " + iae.toString());
        callback.run();
        return;
    }

    callback.run();

    RequestorBtc.getUTXOListBch(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() {
        @Override
        public void onSuccess(Object response) {
            List<UTXOItem> utxos = (List<UTXOItem>)response;
            setUTXO(utxos);
        }

        @Override
        public void onFailure(String msg) {

        }
    });
}
 
Example #29
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public void restoreFromBlockByWif(String wif, WalletCreationCallback callback) {
    wif = wif.trim();
    try {
        DumpedPrivateKey dumpedPrivateKey = DumpedPrivateKey.fromBase58(params, wif);
        ECKey key = dumpedPrivateKey.getKey();
        wallet = new Wallet(params);
        wallet.importKey(key);
        restFromWif = true;
        walletFriendlyAddress = wallet.getImportedKeys().get(0).toAddress(params).toString();
        wifKey = wif;
    } catch (IllegalArgumentException iae) {
        FirebaseCrash.report(iae);
        Log.e("psd", "restoreFromBlockByWif: " + iae.toString());
        callback.onWalletCreated(wallet);
        return;
    }

    callback.onWalletCreated(wallet);

    RequestorBtc.getUTXOListBch(walletFriendlyAddress, new ApiMethods.RequestListener() {
        @Override
        public void onSuccess(Object response) {
            List<UTXOItem> utxos = (List<UTXOItem>)response;
            setUTXO(utxos);
        }

        @Override
        public void onFailure(String msg) {

        }
    });
}
 
Example #30
Source File: WalletManager.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public void restoreFromBlockByXPRV(String xprv, WalletCreationCallback callback) {
    xprv = xprv.trim();
    try {
        DeterministicKey dk01 = DeterministicKey.deserializeB58(xprv, params);
        String privhex = dk01.getPrivateKeyAsHex();
        ECKey ecKey001 = ECKey.fromPrivate(Hex.decode(privhex));
        KeyChainGroup kcg = new KeyChainGroup(params, dk01.dropPrivateBytes().dropParent());
        kcg.importKeys(ecKey001);
        wallet = new Wallet(params, kcg);
        walletFriendlyAddress = wallet.currentReceiveAddress().toString();
        xprvKey = xprv;
    } catch (IllegalArgumentException iae) {
        FirebaseCrash.report(iae);
        Log.e("psd", "restoreFromBlockByXPRV: " + iae.toString());
        callback.onWalletCreated(wallet);
        return;
    }

    callback.onWalletCreated(wallet);

    RequestorBtc.getUTXOListBch(wallet.currentReceiveAddress().toString(), new ApiMethods.RequestListener() {
        @Override
        public void onSuccess(Object response) {
            List<UTXOItem> utxos = (List<UTXOItem>)response;
            setUTXO(utxos);
        }

        @Override
        public void onFailure(String msg) {

        }
    });
}