List of usage examples for android.content Intent getByteArrayExtra
public byte[] getByteArrayExtra(String name)
From source file:com.android.mail.NotificationActionIntentService.java
@Override protected void onHandleIntent(final Intent intent) { final Context context = this; final String action = intent.getAction(); /*/* w ww. j a v a2 s .c o m*/ * Grab the alarm from the intent. Since the remote AlarmManagerService fills in the Intent * to add some extra data, it must unparcel the NotificationAction object. It throws a * ClassNotFoundException when unparcelling. * To avoid this, do the marshalling ourselves. */ final NotificationAction notificationAction; final byte[] data = intent.getByteArrayExtra(EXTRA_NOTIFICATION_ACTION); if (data != null) { final Parcel in = Parcel.obtain(); in.unmarshall(data, 0, data.length); in.setDataPosition(0); notificationAction = NotificationAction.CREATOR.createFromParcel(in, NotificationAction.class.getClassLoader()); } else { LogUtils.wtf(LOG_TAG, "data was null trying to unparcel the NotificationAction"); return; } final Message message = notificationAction.getMessage(); final ContentResolver contentResolver = getContentResolver(); LogUtils.i(LOG_TAG, "Handling %s", action); logNotificationAction(action, notificationAction); if (notificationAction.getSource() == NotificationAction.SOURCE_REMOTE) { // Skip undo if the action is bridged from remote node. This should be similar to the // logic after the Undo notification expires in a regular flow. LogUtils.d(LOG_TAG, "Canceling %s", notificationAction.getNotificationId()); NotificationManagerCompat.from(context).cancel(notificationAction.getNotificationId()); NotificationActionUtils.processDestructiveAction(this, notificationAction); NotificationActionUtils.resendNotifications(context, notificationAction.getAccount(), notificationAction.getFolder()); return; } if (ACTION_UNDO.equals(action)) { NotificationActionUtils.cancelUndoTimeout(context, notificationAction); NotificationActionUtils.cancelUndoNotification(context, notificationAction); } else if (ACTION_ARCHIVE_REMOVE_LABEL.equals(action) || ACTION_DELETE.equals(action)) { // All we need to do is switch to an Undo notification NotificationActionUtils.createUndoNotification(context, notificationAction); NotificationActionUtils.registerUndoTimeout(context, notificationAction); } else { if (ACTION_UNDO_TIMEOUT.equals(action) || ACTION_DESTRUCT.equals(action)) { // Process the action NotificationActionUtils.cancelUndoTimeout(this, notificationAction); NotificationActionUtils.processUndoNotification(this, notificationAction); } else if (ACTION_MARK_READ.equals(action)) { final Uri uri = message.uri; final ContentValues values = new ContentValues(1); values.put(UIProvider.MessageColumns.READ, 1); contentResolver.update(uri, values, null, null); } NotificationActionUtils.resendNotifications(context, notificationAction.getAccount(), notificationAction.getFolder()); } }
From source file:org.thoughtcrime.securesms.ShareActivity.java
private void handleResolvedMedia(Intent intent, boolean animate) { long threadId = intent.getLongExtra(EXTRA_THREAD_ID, -1); int distributionType = intent.getIntExtra(EXTRA_DISTRIBUTION_TYPE, -1); Address address = null;//w ww . j a v a 2 s. c o m if (intent.hasExtra(EXTRA_ADDRESS_MARSHALLED)) { Parcel parcel = Parcel.obtain(); byte[] marshalled = intent.getByteArrayExtra(EXTRA_ADDRESS_MARSHALLED); parcel.unmarshall(marshalled, 0, marshalled.length); parcel.setDataPosition(0); address = parcel.readParcelable(getClassLoader()); parcel.recycle(); } boolean hasResolvedDestination = threadId != -1 && address != null && distributionType != -1; if (!hasResolvedDestination && animate) { ViewUtil.fadeIn(contactsFragment.getView(), 300); ViewUtil.fadeOut(progressWheel, 300); } else if (!hasResolvedDestination) { contactsFragment.getView().setVisibility(View.VISIBLE); progressWheel.setVisibility(View.GONE); } else { createConversation(threadId, address, distributionType); } }
From source file:com.hmsoft.weargoproremote.services.WearMessageHandlerService.java
@Override public boolean handleMessage(Message msg) { Intent intent = (Intent) msg.obj; final String action = intent.getAction(); final String message = intent.getStringExtra(EXTRA_MESSAGE); final byte[] data = intent.getByteArrayExtra(EXTRA_DATA); long startTime = System.currentTimeMillis(); switch (action) { case ACTION_HANDLE_MESSAGE_FROM_WEAR: if (!mStopped) handleMessage(message, data); break;//from w w w. j a v a 2 s . c om case ACTION_SEND_MESSAGE_TO_WEAR: sendToWearable(message, data); break; case ACTION_STOP: boolean sendStopMsg = !intent.getBooleanExtra(EXTRA_DONT_SEND_STOP_TO_WEAR, false); if (sendStopMsg) sendToWearable(WearMessages.MESSAGE_STOP, null); handleMessage(WearMessages.MESSAGE_DISCONNECT, null); break; } if (BuildConfig.DEBUG) { long time = System.currentTimeMillis() - startTime; Logger.debug(TAG, "Message %s handled in %ds (%d)", message, time / 1000, time); } return true; }
From source file:com.HumanDecisionSupportSystemsLaboratory.DD_P2P.Main.java
@TargetApi(Build.VERSION_CODES.KITKAT) @Override/*from w ww . j a va 2 s . c om*/ protected void onActivityResult(int requestCode, int resultCode, Intent resultData) { if (resultCode == RESULT_OK && requestCode == this.RESULT_ADD_PEER) { byte[] _pi = resultData.getByteArrayExtra(AddSafe.PI); net.ddp2p.common.hds.PeerInput pi = null; if (_pi != null) try { pi = new PeerInput().decode(new Decoder(_pi)); } catch (Exception e) { e.printStackTrace(); } if (pi == null) pi = Safe.peerInput; new PeerCreatingThread(pi).start(); super.onActivityResult(requestCode, resultCode, resultData); return; } if (resultCode == RESULT_OK && resultData != null) { Uri uri = null; if (requestCode == SELECT_PHOTO) { uri = resultData.getData(); Log.i("Uri", "Uri: " + uri.toString()); } else if (requestCode == SELECT_PHOTO_KITKAT) { uri = resultData.getData(); Log.i("Uri_kitkat", "Uri: " + uri.toString()); final int takeFlags = resultData.getFlags() & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); // Check for the freshest data. getContentResolver().takePersistableUriPermission(uri, takeFlags); } selectedImagePath = FileUtils.getPath(this, uri); Log.i("path", "path: " + selectedImagePath); selectImageFile = new File(selectedImagePath); String error; StegoStructure adr[] = DD.getAvailableStegoStructureInstances(); int[] selected = new int[1]; try { error = DD.loadBMP(selectImageFile, adr, selected); Log.i("error", "error: " + error); if (error == "") { adr[selected[0]].save(); Toast.makeText(this, "add new safe other successfully!", Toast.LENGTH_SHORT).show(); } } catch (Exception e) { Toast.makeText(this, "Unable to load safe from this photo!", Toast.LENGTH_SHORT).show(); e.printStackTrace(); } } super.onActivityResult(requestCode, resultCode, resultData); }
From source file:it.sineo.android.tileMapEditor.HomeActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == C.REQ_CODE_NEW_MAP) { if (resultCode == RESULT_OK && data != null) { String mapJSON = data.getStringExtra(C.EXTRA_MAP_JSON); TileMap map = new TileMap(mapJSON); ContentValues values = new ContentValues(); values.put(TileMap.Columns.KEY_NAME, map.name); values.put(TileMap.Columns.KEY_JSON_DATA, mapJSON); values.put(TileMap.Columns.KEY_THUMB, data.getByteArrayExtra(C.EXTRA_MAP_THUMB)); getContentResolver().insert(C.CONTENT_URI, values); }//from ww w .j a v a 2 s.com Log.d(TAG, "received code " + resultCode + " w/ data: " + data); } else if (requestCode == C.REQ_CODE_EDIT_MAP) { if (resultCode == RESULT_OK && data != null) { String mapJSON = data.getStringExtra(C.EXTRA_MAP_JSON); long id = data.getLongExtra(C.EXTRA_MAP_ID, -1); TileMap map = new TileMap(mapJSON); ContentValues values = new ContentValues(); values.put(TileMap.Columns.KEY_NAME, map.name); values.put(TileMap.Columns.KEY_JSON_DATA, mapJSON); values.put(TileMap.Columns.KEY_THUMB, data.getByteArrayExtra(C.EXTRA_MAP_THUMB)); Uri mapUri = Uri.withAppendedPath(C.CONTENT_URI, Long.toString(id)); getContentResolver().update(mapUri, values, null, null); } } super.onActivityResult(requestCode, resultCode, data); }
From source file:org.kontalk.ui.CodeValidation.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.code_validation_screen); setupToolbar(true, false);//from w ww . j a va 2 s.c o m mCode = (EditText) findViewById(R.id.validation_code); mButton = (Button) findViewById(R.id.send_button); mFallbackButton = (Button) findViewById(R.id.fallback_button); mCallButton = (Button) findViewById(R.id.code_validation_call); mProgress = (ProgressBar) findViewById(R.id.progressbar); // configuration change?? RetainData data = (RetainData) getLastCustomNonConfigurationInstance(); if (data != null) { mValidator = data.validator; if (mValidator != null) { startProgress(); mValidator.setListener(this); } mTrustedKeys = data.trustedKeys; } int requestCode = getIntent().getIntExtra("requestCode", -1); if (requestCode == NumberValidation.REQUEST_VALIDATION_CODE || getIntent().getStringExtra("sender") == null) { findViewById(R.id.code_validation_sender).setVisibility(View.GONE); findViewById(R.id.code_validation_intro2).setVisibility(View.GONE); ((TextView) findViewById(R.id.code_validation_intro)).setText(R.string.code_validation_intro_manual); } else { String challenge = getIntent().getStringExtra("challenge"); String sender = getIntent().getStringExtra("sender"); final TextView senderText = (TextView) findViewById(R.id.code_validation_sender); CharSequence textId1, textId2; if (NumberValidator.isMissedCall(sender) || NumberValidator.CHALLENGE_MISSED_CALL.equals(challenge)) { // reverse missed call textId1 = getText(R.string.code_validation_intro_missed_call); textId2 = getString(R.string.code_validation_intro2_missed_call, NumberValidator.getChallengeLength(sender)); mFallbackButton.setText(R.string.button_validation_fallback); mFallbackButton.setVisibility(View.VISIBLE); // show sender label and hide call button senderText.setText(sender); senderText.setVisibility(View.VISIBLE); mCallButton.setVisibility(View.GONE); mCode.setVisibility(View.VISIBLE); } else if (NumberValidator.CHALLENGE_CALLER_ID.equals(challenge)) { // user-initiated missed call textId1 = getText(R.string.code_validation_intro_callerid); textId2 = getText(R.string.code_validation_intro2_callerid); mFallbackButton.setText(R.string.button_validation_fallback_callerid); mFallbackButton.setVisibility(View.VISIBLE); // show call button and hide sender label mCallButton.setText(sender); mCallButton.setVisibility(View.VISIBLE); senderText.setVisibility(View.GONE); mCode.setVisibility(View.GONE); } else { // PIN code textId1 = getText(R.string.code_validation_intro); textId2 = getText(R.string.code_validation_intro2); mFallbackButton.setVisibility(View.GONE); // show sender label and hide call button senderText.setText(sender); senderText.setVisibility(View.VISIBLE); mCallButton.setVisibility(View.GONE); mCode.setVisibility(View.VISIBLE); } if (mCallButton.getVisibility() == View.VISIBLE) { mCallButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { SystemUtils.dial(CodeValidation.this, mCallButton.getText()); } }); } ((TextView) findViewById(R.id.code_validation_intro)).setText(textId1); ((TextView) findViewById(R.id.code_validation_intro2)).setText(textId2); } Intent i = getIntent(); mKey = i.getParcelableExtra(KeyPairGeneratorService.EXTRA_KEY); mName = i.getStringExtra("name"); mPhone = i.getStringExtra("phone"); mForce = i.getBooleanExtra("force", false); mPassphrase = i.getStringExtra("passphrase"); mImportedPrivateKey = i.getByteArrayExtra("importedPrivateKey"); mImportedPublicKey = i.getByteArrayExtra("importedPublicKey"); mTrustedKeys = (HashMap) i.getSerializableExtra("trustedKeys"); String server = i.getStringExtra("server"); if (server != null) mServerProvider = new EndpointServer.SingleServerProvider(server); else /* * FIXME HUGE problem here. If we already have a verification code, * how are we supposed to know from what server it came from?? * https://github.com/kontalk/androidclient/issues/118 */ mServerProvider = Preferences.getEndpointServerProvider(this); }
From source file:org.sufficientlysecure.keychain.ui.CreateKeyActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // React on NDEF_DISCOVERED from Manifest // NOTE: ACTION_NDEF_DISCOVERED and not ACTION_TAG_DISCOVERED like in BaseNfcActivity if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent().getAction())) { mNfcTagDispatcher.interceptIntent(getIntent()); setTitle(R.string.title_manage_my_keys); // done// ww w .j a va 2 s .c om return; } // Check whether we're recreating a previously destroyed instance if (savedInstanceState != null) { // Restore value of members from saved state mName = savedInstanceState.getString(EXTRA_NAME); mEmail = savedInstanceState.getString(EXTRA_EMAIL); mAdditionalEmails = savedInstanceState.getStringArrayList(EXTRA_ADDITIONAL_EMAILS); mPassphrase = savedInstanceState.getParcelable(EXTRA_PASSPHRASE); mFirstTime = savedInstanceState.getBoolean(EXTRA_FIRST_TIME); mCreateSecurityToken = savedInstanceState.getBoolean(EXTRA_CREATE_SECURITY_TOKEN); mSecurityTokenAid = savedInstanceState.getByteArray(EXTRA_SECURITY_TOKEN_AID); mSecurityTokenPin = savedInstanceState.getParcelable(EXTRA_SECURITY_TOKEN_PIN); mSecurityTokenAdminPin = savedInstanceState.getParcelable(EXTRA_SECURITY_TOKEN_ADMIN_PIN); mCurrentFragment = getSupportFragmentManager().findFragmentByTag(FRAGMENT_TAG); } else { Intent intent = getIntent(); // Initialize members with default values for a new instance mName = intent.getStringExtra(EXTRA_NAME); mEmail = intent.getStringExtra(EXTRA_EMAIL); mFirstTime = intent.getBooleanExtra(EXTRA_FIRST_TIME, false); mCreateSecurityToken = intent.getBooleanExtra(EXTRA_CREATE_SECURITY_TOKEN, false); if (intent.hasExtra(EXTRA_SECURITY_FINGERPRINTS)) { byte[] nfcFingerprints = intent.getByteArrayExtra(EXTRA_SECURITY_FINGERPRINTS); String nfcUserId = intent.getStringExtra(EXTRA_SECURITY_TOKEN_USER_ID); byte[] nfcAid = intent.getByteArrayExtra(EXTRA_SECURITY_TOKEN_AID); if (containsKeys(nfcFingerprints)) { Fragment frag = CreateSecurityTokenImportResetFragment.newInstance(nfcFingerprints, nfcAid, nfcUserId); loadFragment(frag, FragAction.START); setTitle(R.string.title_import_keys); } else { Fragment frag = CreateSecurityTokenBlankFragment.newInstance(nfcAid); loadFragment(frag, FragAction.START); setTitle(R.string.title_manage_my_keys); } // done return; } // normal key creation CreateKeyStartFragment frag = CreateKeyStartFragment.newInstance(); loadFragment(frag, FragAction.START); } if (mFirstTime) { setTitle(R.string.app_name); mToolbar.setNavigationIcon(null); mToolbar.setNavigationOnClickListener(null); } else { setTitle(R.string.title_manage_my_keys); } }
From source file:mai.whack.StickyNotesActivity.java
private void onDataRead(Intent intent) { // Parse the intent NdefMessage[] msgs = null;/* ww w . j a va2 s. c om*/ String action = intent.getAction(); byte[] tagId = null; if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) { Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); tagId = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID); if (rawMsgs != null) { msgs = new NdefMessage[rawMsgs.length]; for (int i = 0; i < rawMsgs.length; i++) { msgs[i] = (NdefMessage) rawMsgs[i]; } } else { // Unknown tag type byte[] empty = new byte[] {}; NdefRecord record = new NdefRecord(NdefRecord.TNF_UNKNOWN, empty, empty, empty); NdefMessage msg = new NdefMessage(new NdefRecord[] { record }); msgs = new NdefMessage[] { msg }; } } else { Log.d(TAG, "Unknown intent."); finish(); } String msg = new String(msgs[0].getRecords()[0].getPayload()); mHttpGetThread = new HttpGetThread("http://192.168.1.192/store/" + toHex(tagId)); mHttpGetThread.start(); // mHttpPostThread = new HttpPostThread("aaaaa", "bbbbb", "sdgsdfdsfs"); // mHttpPostThread.start(); }
From source file:net.geniecode.ttr.ScheduleReceiver.java
@SuppressWarnings("deprecation") @SuppressLint({ "Recycle", "NewApi", "InlinedApi" }) @Override/*ww w. j a va 2 s. c o m*/ public void onReceive(Context context, Intent intent) { if (!Schedules.SCHEDULE_ACTION.equals(intent.getAction())) { // Unknown intent, bail. return; } Schedule schedule = null; // Grab the schedule from the intent. Since the remote AlarmManagerService // fills in the Intent to add some extra data, it must unparcel the // Schedule object. It throws a ClassNotFoundException when unparcelling. // To avoid this, do the marshalling ourselves. final byte[] data = intent.getByteArrayExtra(Schedules.SCHEDULE_RAW_DATA); if (data != null) { Parcel in = Parcel.obtain(); in.unmarshall(data, 0, data.length); in.setDataPosition(0); schedule = Schedule.CREATOR.createFromParcel(in); } if (schedule == null) { // Make sure we set the next schedule if needed. Schedules.setNextSchedule(context); return; } // Disable this schedule if it does not repeat. if (!schedule.daysOfWeek.isRepeatSet()) { Schedules.enableSchedule(context, schedule.id, false); } else { // Enable the next schedule if there is one. The above call to // enableSchedule will call setNextSchedule so avoid calling it twice. Schedules.setNextSchedule(context); } long now = System.currentTimeMillis(); if (now > schedule.time + STALE_WINDOW) { return; } // Get telephony service mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); // Execute only for devices with versions of Android less than 4.2 if (android.os.Build.VERSION.SDK_INT < 17) { // Get flight mode state boolean isEnabled = Settings.System.getInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) == 1; // Get Wi-Fi service mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if ((schedule.aponoff) && (!isEnabled) && (schedule.mode.equals("1")) && (mTelephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE)) { // Enable flight mode Settings.System.putInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, isEnabled ? 0 : 1); // Get Wi-Fi state and disable that one too, just in case // (On some devices it doesn't get disabled when the flight mode is // turned on, so we do it here) boolean isWifiEnabled = mWifiManager.isWifiEnabled(); SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0); if (isWifiEnabled) { SharedPreferences.Editor editor = settings.edit(); editor.putBoolean(WIFI_STATE, isWifiEnabled); editor.commit(); mWifiManager.setWifiEnabled(false); } else { SharedPreferences.Editor editor = settings.edit(); editor.putBoolean(WIFI_STATE, isWifiEnabled); editor.commit(); } // Post an intent to reload Intent relintent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); relintent.putExtra("state", !isEnabled); context.sendBroadcast(relintent); } else if ((!schedule.aponoff) && (isEnabled) && (schedule.mode.equals("1"))) { // Disable flight mode Settings.System.putInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, isEnabled ? 0 : 1); // Restore previously remembered Wi-Fi state SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0); Boolean WiFiState = settings.getBoolean(WIFI_STATE, true); if (WiFiState) { mWifiManager.setWifiEnabled(true); } // Post an intent to reload Intent relintent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); relintent.putExtra("state", !isEnabled); context.sendBroadcast(relintent); } // Check whether there are ongoing phone calls, and if so // show notification instead of just enabling the flight mode else if ((schedule.aponoff) && (!isEnabled) && (schedule.mode.equals("1")) && (mTelephonyManager.getCallState() != TelephonyManager.CALL_STATE_IDLE)) { setNotification(context); } // Execute for devices with Android 4.2 or higher } else { // Get flight mode state String result = Settings.Global.getString(context.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON); if ((schedule.aponoff) && (result.equals("0")) && (schedule.mode.equals("1")) && (mTelephonyManager.getCallState() == TelephonyManager.CALL_STATE_IDLE)) { // Keep the device awake while enabling flight mode Intent service = new Intent(context, ScheduleIntentService.class); startWakefulService(context, service); } else if ((!schedule.aponoff) && (result.equals("1")) && (schedule.mode.equals("1"))) { // Keep the device awake while enabling flight mode Intent service = new Intent(context, ScheduleIntentService.class); startWakefulService(context, service); } else if ((schedule.aponoff) && (result.equals("0")) && (schedule.mode.equals("1")) && (mTelephonyManager.getCallState() != TelephonyManager.CALL_STATE_IDLE)) { setNotification(context); } } // Get audio service mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); // Get current ringer mode and set silent or normal mode accordingly switch (mAudioManager.getRingerMode()) { case AudioManager.RINGER_MODE_SILENT: if ((!schedule.silentonoff) && (schedule.mode.equals("2"))) { mAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL); } break; case AudioManager.RINGER_MODE_NORMAL: if ((schedule.silentonoff) && (schedule.mode.equals("2"))) { mAudioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT); } break; case AudioManager.RINGER_MODE_VIBRATE: // If the phone is set to vibrate let's make it completely silent if ((schedule.silentonoff) && (schedule.mode.equals("2"))) { mAudioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT); } // or restore the regular sounds on it if that's scheduled else if ((!schedule.silentonoff) && (schedule.mode.equals("2"))) { mAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL); } break; } }
From source file:crea.wallet.lite.service.CreativeCoinService.java
public void broadcastTransactionPendingTx(Intent data) { if (peerGroup != null) { byte[] rawTx = data.getByteArrayExtra(ACTION_BROADCAST_RAW_TRANSACTION); Transaction tx = new Transaction(NETWORK_PARAMETERS, rawTx); final Sha256Hash hash = tx.getHash(); Log.i(TAG, "broadcasting transaction " + hash.toString()); TransactionBroadcast tb = peerGroup.broadcastTransaction(tx); tb.setTransactionCallback(new FutureCallback<Transaction>() { @Override//w ww . java2 s .com public void onSuccess(@Nullable Transaction transaction) { WalletHelper.INSTANCE.commitTx(transaction); } @Override public void onFailure(Throwable throwable) { if (throwable instanceof RejectedTransactionException) { RejectedTransactionException rte = (RejectedTransactionException) throwable; Log.e(TAG, "Transaction rejected! " + rte.getTransaction().getHashAsString()); Intent rejectIntent = new Intent(TRANSACTION_REJECTED); rejectIntent.putExtra("rawTx", rte.getTransaction().bitcoinSerialize()); sendBroadcast(rejectIntent); } } }); } else { Log.i(TAG, "Tx not available"); } }