@Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == REQUEST_MANUAL_VALIDATION && resultCode == RESULT_OK) {
     finishLogin(
         data.getByteArrayExtra(PARAM_PRIVATEKEY), data.getByteArrayExtra(PARAM_PUBLICKEY));
   }
 }
Esempio n. 2
1
 public k a(Intent intent) {
   k kVar = null;
   String action = intent.getAction();
   c.a("receive an intent from server, action=" + action);
   if ("com.xiaomi.mipush.RECEIVE_MESSAGE".equals(action)) {
     byte[] byteArrayExtra = intent.getByteArrayExtra("mipush_payload");
     boolean booleanExtra = intent.getBooleanExtra("mipush_notified", false);
     if (byteArrayExtra == null) {
       c.c("receiving an empty message, drop");
     } else {
       C1112s c1112s = new C1112s();
       try {
         S.a(c1112s, byteArrayExtra);
         m a = m.a(this.b);
         if (!(c1112s.a() != C1094a.SendMessage || c1112s.m() == null || a.l() || booleanExtra)) {
           a(c1112s);
         }
         if (!a.i() && c1112s.a != C1094a.Registration) {
           c.c("receive message without registration. need unregister or re-register!");
         } else if (!a.i() || !a.n()) {
           kVar = a(c1112s, booleanExtra, byteArrayExtra);
         } else if (c1112s.a == C1094a.UnRegistration) {
           a.h();
           f.d(this.b);
           PushMessageHandler.a();
         } else {
           f.g(this.b);
         }
       } catch (Throwable e) {
         c.a(e);
       } catch (Throwable e2) {
         c.a(e2);
       }
     }
   } else if ("com.xiaomi.mipush.ERROR".equals(action)) {
     kVar = new i();
     Object c1112s2 = new C1112s();
     try {
       byte[] byteArrayExtra2 = intent.getByteArrayExtra("mipush_payload");
       if (byteArrayExtra2 != null) {
         S.a(c1112s2, byteArrayExtra2);
       }
     } catch (f e3) {
     }
     kVar.a(String.valueOf(c1112s2.a()));
     kVar.a((long) intent.getIntExtra("mipush_error_code", 0));
     kVar.b(intent.getStringExtra("mipush_error_msg"));
     c.c(
         "receive a error message. code = "
             + intent.getIntExtra("mipush_error_code", 0)
             + ", msg= "
             + intent.getStringExtra("mipush_error_msg"));
   }
   return kVar;
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.picture_handler_without_sharing);

    Intent intent = getIntent();
    photoBytes = intent.getByteArrayExtra("photo");
    photo = BitmapFactory.decodeByteArray(photoBytes, 0, photoBytes.length);
    displayPhoto();

    Button savePictureButton = (Button) findViewById(R.id.button_savePic);
    savePictureButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            savePic();
          }
        });

    Button backToHomeButton = (Button) findViewById(R.id.ph_backButton);
    backToHomeButton.setVisibility(View.VISIBLE);
    backToHomeButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            finish();
          }
        });
  }
 private void resolveIntent(Intent intent) {
   String action = intent.getAction();
   if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)
       || NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)
       || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
     Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
     NdefMessage[] msgs;
     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[0];
       byte[] id = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID);
       Parcelable tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
       byte[] payload = dumpTagData(tag).getBytes();
       NdefRecord record = new NdefRecord(NdefRecord.TNF_UNKNOWN, empty, id, payload);
       NdefMessage msg = new NdefMessage(new NdefRecord[] {record});
       msgs = new NdefMessage[] {msg};
     }
     // Setup the views
     populateCardID(msgs);
   }
 }
        @Override
        public void onReceive(Context context, Intent intent) {
          final String action = intent.getAction();
          if (BluetoothLeService.ACTION_GATT_CONNECTED.equals(action)) {
            mConnected = true;
            updateConnectionState(R.string.connected);
            invalidateOptionsMenu();
          } else if (BluetoothLeService.ACTION_GATT_DISCONNECTED.equals(action)) {
            mConnected = false;
            updateConnectionState(R.string.disconnected);
            Intent scan_intent = new Intent(DisplaySoundActivity.this, DeviceScanActivity.class);
            startActivity(scan_intent);
            invalidateOptionsMenu();
            // unregisterReceiver(mGattUpdateReceiver);
            finish();

          } else if (BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED.equals(action)) {
            // Show all the supported services and characteristics on the user interface.
            // ** changed //
            services = mBluetoothLeService.getSupportedGattServices();
            getCharacteristics(services);
          } else if (BluetoothLeService.ACTION_DATA_AVAILABLE.equals(action)) {
            onDataRecived(intent.getByteArrayExtra(BluetoothLeService.EXTRA_DATA));
          }
        }
Esempio n. 6
1
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_image_details);
    mPreferencesManager = new PreferencesManager(this);
    ImageView imageView = (ImageView) findViewById(R.id.grid_item_image);
    TextView publisherTextView = (TextView) findViewById(R.id.photoUploader);
    Button shareButton = (Button) findViewById(R.id.sharebutton);
    Intent incomeIntent = getIntent();
    sessionKey = incomeIntent.getStringExtra("sessionKey");

    if (incomeIntent.hasExtra("byteArray")) {
      byte[] bytes = incomeIntent.getByteArrayExtra("byteArray");
      bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
      shareButton.setVisibility(View.INVISIBLE);
      publisherTextView.setText(incomeIntent.getStringExtra("Publisher"));
      publisherTextView.setVisibility(View.VISIBLE);
    } else {
      String imagePath = incomeIntent.getStringExtra("image");
      BitmapFactory.Options options = new BitmapFactory.Options();
      options.inSampleSize = 8;
      bitmap = BitmapFactory.decodeFile(imagePath, options);
      publisherTextView.setVisibility(View.INVISIBLE);
    }

    imageView.setImageBitmap(bitmap);
    imageView.setVisibility(View.VISIBLE);
  }
        @Override
        public void onReceive(Context context, Intent intent) {
          final String action = intent.getAction();

          Log.d(TAG, "receive BLE Action :" + action);
          if (BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED.equals(action)) {
            // 发现蓝牙服务,这时可以发送数据
            //	tv_log.append("发现蓝牙服务完成,发送同步时间命令\n");
            //	mBluetoothLeService.setSynTime();

            tv_log.append("发现蓝牙服务完成,发送获取设备WatchID命令\n");
            mBluetoothLeService.getWatchId();

          } else if (BluetoothLeService.ACTION_GATT_SERVICES_TIMEOUT.equals(action)) {
            // 蓝牙通讯超时,这里可以重发未响应的命令
            tv_log.append("蓝牙命令超时.......\n");

          } else if (BluetoothLeService.ACTION_GATT_DISCONNECTED.equals(action)) {
            // 蓝牙断开
            tv_log.append("蓝牙连接断开.......\n");

          } else if (BluetoothLeService.ACTION_DATA_AVAILABLE.equals(action)) {
            // 接收到蓝牙数据

            byte[] bytes = intent.getByteArrayExtra(BluetoothLeService.EXTRA_DATA);
            tv_log.append("接收到数据:" + ProtocolParser.bytes2HexString(bytes) + "\n");

            pasrseData(bytes);
          }
        }
 @Override
 public void onReceive(Context context, Intent intent) {
   byte[] bytes = intent.getByteArrayExtra("icon");
   mBitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
   mHighText = Integer.toString(intent.getIntExtra("high", 1));
   mLowText = Integer.toString(intent.getIntExtra("low", 1));
 }
Esempio n. 9
0
    @Override
    public void onReceive(Context context, Intent intent) {
      Log.v(TAG, "BluetoothReceiver onReceive");
      if (intent.getAction().equals(OperationActivityHD.BLUETOOTHRECEIVER_ACTION)) {
        int cmd = intent.getIntExtra("cmd", -1); //

        switch (cmd) {
          case REQUIRE_CONNECT:
            //					BluetoothService.addNewDevice=true;
            STOPFLAG = false;

            ADDRESS = intent.getStringExtra(OperationActivityHD.DEVICE_ADDRESS);
            BluetoothDevice device = mAdapter.getRemoteDevice(ADDRESS);
            Log.d(TAG, "Receiver get address----------->" + "--" + ADDRESS);
            BluetoothService.this.connect(device);

            break;
          case REQUIRE_WRITE:
            final byte[] command = intent.getByteArrayExtra("command");
            // int value = intent.getIntExtra("value", 0);

            write(command);
            if (D)
              Log.d(
                  TAG, "·¢ËÍÖ¸Áî---------->" + RokolUtil.bytesToHexString(command, command.length));
            break;
          case 2:
            break;
          case 10:
            Log.d(TAG, "Close socket----------->");
            break;
        }
      }
    }
Esempio n. 10
0
        @Override
        public void onReceive(Context context, Intent intent) {

          final String action = intent.getAction();
          Log.d(TAG, "action: " + action);

          if (BluetoothLeService.ACTION_DATA_NOTIFY.equals(action)) {
            byte[] value = intent.getByteArrayExtra(BluetoothLeService.EXTRA_DATA);
            String uuidStr = intent.getStringExtra(BluetoothLeService.EXTRA_UUID);
            if (uuidStr.equals(mCharIdentify.getUuid().toString())) {
              // Image info notification
              mTargImgHdr.ver = Conversion.buildUint16(value[1], value[0]);
              mTargImgHdr.imgType = ((mTargImgHdr.ver & 1) == 1) ? 'B' : 'A';
              mTargImgHdr.len = Conversion.buildUint16(value[3], value[2]);
              displayImageInfo(mTargImage, mTargImgHdr);
            }
          } else if (BluetoothLeService.ACTION_DATA_WRITE.equals(action)) {
            int status =
                intent.getIntExtra(BluetoothLeService.EXTRA_STATUS, BluetoothGatt.GATT_SUCCESS);
            if (status != BluetoothGatt.GATT_SUCCESS) {
              Log.e(TAG, "Write failed: " + status);
              Toast.makeText(context, "GATT error: status=" + status, Toast.LENGTH_SHORT).show();
            }
          }
        }
Esempio n. 11
0
        public void onReceive(Context context, Intent intent) {
          String action = intent.getAction();

          final Intent mIntent = intent;
          // *********************//
          if (action.equals(UartService.ACTION_GATT_CONNECTED)) {
            runOnUiThread(
                new Runnable() {
                  public void run() {
                    textView1.append("Connected\n");
                    mState = "Connected";
                  }
                });
          }

          // *********************//
          if (action.equals(UartService.ACTION_GATT_DISCONNECTED)) {
            runOnUiThread(
                new Runnable() {
                  public void run() {
                    textView1.append("Disconnected\n");
                    mState = "Disconnected";
                    mService.close();
                  }
                });
          }

          // *********************//
          if (action.equals(UartService.ACTION_GATT_SERVICES_DISCOVERED)) {
            mService.enableTXNotification();
          }
          // *********************//
          if (action.equals(UartService.ACTION_DATA_AVAILABLE)) {

            final byte[] txValue = intent.getByteArrayExtra(UartService.EXTRA_DATA);
            runOnUiThread(
                new Runnable() {
                  public void run() {
                    try {
                      String text = new String(txValue, "UTF-8");
                      textView1.append("RX: " + text + "\n");
                    } catch (Exception e) {
                      Log.e("powenko.com", e.toString());
                    }
                  }
                });
          }
          // *********************//
          if (action.equals(UartService.DEVICE_DOES_NOT_SUPPORT_UART)) {
            runOnUiThread(
                new Runnable() {
                  public void run() {
                    textView1.append("Device doesn't support UART. Disconnecting");
                  }
                });
            mService.disconnect();
          }
        }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_acquire_gps);

    setUseExitWarning(true);
    setUseLostConnectionWarning(true);

    setResult(RESULT_CANCELED);

    if (!isCanceling()) {
      SheetLayoutEx.enterFromBottomAnimation(this);
      Intent intent = getIntent();
      if (intent != null && intent.getExtras() != null) {
        _Bursts = new ArrayList<>();

        try {
          _Point = (GpsPoint) intent.getSerializableExtra(Consts.Codes.Data.POINT_DATA);
          _Metadata = intent.getParcelableExtra(Consts.Codes.Data.METADATA_DATA);

          setZone(_Metadata.getZone());

          if (intent.getExtras().containsKey(Consts.Codes.Data.ADDITIVE_NMEA_DATA)) {
            _Bursts =
                TtNmeaBurst.bytesToBursts(
                    intent.getByteArrayExtra(Consts.Codes.Data.ADDITIVE_NMEA_DATA));
            setLoggedCount(_Bursts.size());
          }

        } catch (Exception e) {
          e.printStackTrace();
        }
      } else {
        setResult(Consts.Codes.Results.NO_POINT_DATA);
        finish();
        return;
      }

      ActionBar actionBar = getSupportActionBar();
      if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(false);
      }

      tvLogged = (TextView) findViewById(R.id.acquireGpsToolbarLblLoggedValue);
      tvRecv = (TextView) findViewById(R.id.acquireGpsToolbarLblReceivedValue);

      btnLog = (Button) findViewById(R.id.aqrBtnLog);
      btnCalc = (Button) findViewById(R.id.aqrBtnCalc);

      if (_Bursts.size() > 0) {
        btnCalc.setEnabled(true);
      } else {
        btnCalc.setBackgroundColor(AndroidUtils.UI.getColor(this, R.color.primaryLighter));
      }

      // setupMap();
    }
  }
Esempio n. 13
0
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode == RESULT_OK && requestCode == SEARCH_BING) {
     byte[] imageData = data.getByteArrayExtra("image");
     Intent forwardIntent = new Intent();
     forwardIntent.putExtra("image", imageData);
     setResult(RESULT_OK, forwardIntent);
     finish();
   }
 }
 private void resolveIntent(Intent intent) {
   String action = intent.getAction();
   if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
     byte[] id = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID);
     id_string = ByteArrayToHexString(id);
     nouveauProduitScanne = true;
     afficherProduitsAAcheter();
   }
 }
 @Override
 public int onStartCommand(Intent intent, int flags, int startId) {
   if (intent != null && intent.getAction() != null) {
     if (intent.getAction().equals(Constant.ACTION_GET_BLE_BATTERY)) {
       bleHelper.readBattery();
     } else if (intent.getAction().equals(Constant.ACTION_GET_BLE_RTC)) {
       bleHelper.readRTC();
     } else if (intent.getAction().equals(Constant.ACTION_SET_BLE_BUZZER)) {
       bleHelper.writeBuzzer(intent.getByteArrayExtra("data"));
     } else if (intent.getAction().equals(Constant.ACTION_SET_BLE_LED)) {
       bleHelper.writeLed(intent.getByteArrayExtra("data"));
     } else if (intent.getAction().equals(Constant.ACTION_SET_BLE_RTC)) {
       bleHelper.writeRTC(intent.getByteArrayExtra("data"));
     } else if (intent.getAction().equals(Constant.ACTION_GET_BLE_QUATERNION)) {
       bleHelper.readQuaternion();
     }
   }
   return super.onStartCommand(intent, flags, startId);
 }
Esempio n. 16
0
  @Override
  public int onStartCommand(Intent intent, int flags, int startId) {
    // Hier wird das Bild aus dem durchgereichten Bundle extrahiert
    startPlatform();
    bytearray = intent.getByteArrayExtra("Bytearray");
    level = intent.getIntExtra("level", 12345);
    wifi = intent.getBooleanExtra("wifi", false);

    return START_STICKY;
  }
Esempio n. 17
0
  @Override
  public void onNewIntent(Intent intent) {
    nfcid = "";
    if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) {
      nfcid = this.ByteArrayToHexString(intent.getByteArrayExtra(NfcAdapter.EXTRA_ID));
      Log.i("Huy", "NDEF DISCOVERED = " + nfcid);

    } else if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())) {
      nfcid = this.ByteArrayToHexString(intent.getByteArrayExtra(NfcAdapter.EXTRA_ID));
      Log.i("Huy", "TAG DISCOVERED = " + nfcid);

    } else if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(intent.getAction())) {
      nfcid = this.ByteArrayToHexString(getIntent().getByteArrayExtra(NfcAdapter.EXTRA_ID));
      Log.i("Huy", "TECH DISCOVERED = " + nfcid);
    }
    setIntent(intent);
    processNfcID();
    // resolveIntent(intent);
  }
Esempio n. 18
0
  private void handleDeliveredMessage(Intent intent) {
    long messageId = intent.getLongExtra("message_id", -1);
    byte[] pdu = intent.getByteArrayExtra("pdu");
    SmsMessage message = SmsMessage.createFromPdu(pdu);

    if (message == null) {
      return;
    }

    DatabaseFactory.getSmsDatabase(context).markStatus(messageId, message.getStatus());
  }
Esempio n. 19
0
 /** 从上一个页面获取信息 */
 public void getInfo() {
   Intent intent = getIntent();
   byte[] bytes = intent.getByteArrayExtra("info");
   if (bytes != null) {
     ByteArrayInputStream byteStream = new ByteArrayInputStream(bytes);
     try {
       ObjectInputStream objStream = new ObjectInputStream(byteStream);
       info = (BetQueryInfo) objStream.readObject();
     } catch (Exception e) {
     }
   }
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_work_mapping_activity);
    //
    Intent recieve = getIntent();
    buildingImg = recieve.getByteArrayExtra("img");
    z = recieve.getDoubleExtra("z", 0);
    scale = recieve.getDoubleExtra("scale", 0.05);
    savedPoint = new xy();
    curPoint = new xy();
    //
    getWindowSize();
    drawer = (SlidingDrawer) findViewById(R.id.activity_work_mapping_drawer);
    menulayer =
        (LinearLayout) findViewById(R.id.activity_work_mapping_draggable_containmenubuttonlayout);
    map_frame = (FrameLayout) findViewById(R.id.activity_work_mapping_draggable_frame);
    DimageView = (DraggableImageView) findViewById(R.id.activity_work_mapping_draggable_imageview);
    //
    BitmapFactory.Options option = new BitmapFactory.Options();
    option.inScaled = false;
    //

    Bitmap backgroudImage = getMapBitmap(option);
    createOverlayView(backgroudImage.getWidth(), backgroudImage.getHeight(), backgroudImage);
    setImageHandler();
    DimageView.setHandler(handler);
    DimageView.setDmetric(getDispaymetric());
    DimageView.setImageBitmap(backgroudImage);
    arr_button_menu = new Button[8];

    measureCheckBox = (CheckBox) findViewById(R.id.activity_work_mapping_drawer_check_measure);
    measureCheckBox.setOnCheckedChangeListener(checkboxListener);
    measureCheckBox.setTag(1);
    measureCheckBox.setChecked(true);
    poiCheckBox = (CheckBox) findViewById(R.id.activity_work_mapping_drawer_check_poi);
    poiCheckBox.setOnCheckedChangeListener(checkboxListener);
    poiCheckBox.setTag(2);
    poiCheckBox.setChecked(true);
    wayCheckBox = (CheckBox) findViewById(R.id.activity_work_mapping_drawer_check_way);
    wayCheckBox.setOnCheckedChangeListener(checkboxListener);
    wayCheckBox.setTag(3);
    wayCheckBox.setChecked(true);
    UpdateButton = (Button) findViewById(R.id.activity_work_mapping_drawer_button_update);
    UpdateButton.setOnClickListener(l);

    createPOIInputDialog();
    createMeasureDialog();
    setInputHandler();

    init();
  }
Esempio n. 21
0
 /** 从上一个页面获取信息 */
 public void getInfo() {
   Intent intent = getIntent();
   byte[] bytes = intent.getByteArrayExtra("info");
   zhumaStr = intent.getStringExtra("zhuma");
   if (bytes != null) {
     ByteArrayInputStream byteStream = new ByteArrayInputStream(bytes);
     try {
       ObjectInputStream objStream = new ObjectInputStream(byteStream);
       betAndGift = (BetAndGiftPojo) objStream.readObject();
     } catch (Exception e) {
     }
   }
 }
  @Override
  public void onReceive(Context context, Intent intent) {
    mContext = context;
    if (MESSAGE_STATUS_RECEIVED_ACTION.equals(intent.getAction())) {

      Uri messageUri = intent.getData();
      byte[] pdu = intent.getByteArrayExtra("pdu");

      boolean isStatusMessage = updateMessageStatus(context, messageUri, pdu);

      // Called on the UI thread so don't block.
      MessagingNotification.nonBlockingUpdateNewMessageIndicator(context, true, isStatusMessage);
    }
  }
Esempio n. 23
0
  @Override
  public void onNewIntent(Intent intent) {
    // fetch the tag from the intent
    String tagId = "";
    String action = intent.getAction();
    if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)) {
      tagId =
          Functions.ByteArrayToHexString((byte[]) intent.getByteArrayExtra(NfcAdapter.EXTRA_ID));
    } else if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)) {
      Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
      tagId = Functions.ByteArrayToHexString(tag.getId());
    }

    if (!tagId.equals("")) tagDiscovered(tagId);
  }
Esempio n. 24
0
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == 0) {
      if (resultCode == RESULT_OK) {
        // Use Data to get string
        ImageView jpgView = (ImageView) findViewById(R.id.jpgview);
        TextView txtView = (TextView) findViewById(R.id.textViewNoImage);
        filePath = data.getStringExtra("RESULT_STRING");
        image = data.getByteArrayExtra("RESULT_IMG");

        BitmapDrawable d = new BitmapDrawable(getResources(), filePath);
        txtView.setVisibility(View.INVISIBLE);
        jpgView.setImageDrawable(d);
      }
    }
  }
Esempio n. 25
0
 public static IntentResult parseActivityResult(int requestCode, int resultCode, Intent intent) {
   if (requestCode == REQUEST_CODE) {
     if (resultCode == Activity.RESULT_OK) {
       String contents = intent.getStringExtra("SCAN_RESULT");
       String formatName = intent.getStringExtra("SCAN_RESULT_FORMAT");
       byte[] rawBytes = intent.getByteArrayExtra("SCAN_RESULT_BYTES");
       int intentOrientation = intent.getIntExtra("SCAN_RESULT_ORIENTATION", Integer.MIN_VALUE);
       Integer orientation = intentOrientation == Integer.MIN_VALUE ? null : intentOrientation;
       String errorCorrectionLevel = intent.getStringExtra("SCAN_RESULT_ERROR_CORRECTION_LEVEL");
       return new IntentResult(contents, formatName, rawBytes, orientation, errorCorrectionLevel);
     }
     return new IntentResult();
   }
   return null;
 }
  @Override
  protected void onNewIntent(Intent intent) {
    if (intent.getAction().equals(NfcAdapter.ACTION_TAG_DISCOVERED)) {

      String tag = byteArrayToHexString(intent.getByteArrayExtra(NfcAdapter.EXTRA_ID));

      Log.d(TAG, "======NFC TAG=====");
      Log.d(TAG, tag);
      Log.d(TAG, "==================");

      startPresentation(tag);

      //

    }
  }
  private void receiveMessage(Intent intent) {
    if (!intent.hasExtra(EXTRA_PDU_BYTES)
        || !intent.hasExtra(EXTRA_BINARY_FLAG)) { // should never happen
      Log.e(TAG, "Missing extras!");
      return;
    }

    // get PDU from intent:
    byte[] pdu = intent.getByteArrayExtra(EXTRA_PDU_BYTES);
    boolean binary = intent.getBooleanExtra(EXTRA_BINARY_FLAG, false);

    Log.d(
        TAG,
        (binary ? "Binary" : "Textual") + " SMS received by Sapelli " + getClass().getSimpleName());

    // Treat incoming message:
    try {
      // Create a (Sapelli) Message object from the PDU:
      final Message<?, ?> message = messageFromPDU(pdu, binary);

      // Receive/decode:
      transmissionController.receiveSMS(message);

      // Show toast when in debug mode:
      if (BuildConfig.DEBUG)
        mainHandler.post(
            new Runnable() {
              @Override
              public void run() {
                Toast.makeText(
                        IncomingSMSReceiverService.this,
                        "Sapelli SMS received from phone number "
                            + message.getSender().getPhoneNumberInternational(),
                        Toast.LENGTH_SHORT)
                    .show();
              }
            });
    } catch (InvalidMessageException e) {
      Log.i(TAG, "Received SMS message was found not to be relevant to Sapelli.");
      Log.d(TAG, "\t" + InvalidMessageException.class.getSimpleName(), e);
    } catch (Exception e) {
      Log.e(TAG, "An error occurred while trying to parse the received SMS.", e);
    }
  }
Esempio n. 28
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);

    Intent intent = getIntent();
    byte[] key = intent.getByteArrayExtra("key");
    String topic = intent.getStringExtra("topic");
    String password = intent.getStringExtra("password");
    String userID = intent.getStringExtra("userID");
    System.out.println("トピック: " + topic);
    System.out.println("鍵: " + key.toString());
    System.out.println("パスワード: " + password);
    System.out.println("ユーザID: " + userID);

    SupportMapFragment mapFragment =
        (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
  }
 /**
  * Call this from your {@link Activity}'s {@link Activity#onActivityResult(int, int, Intent)}
  * method.
  *
  * @param requestCode request code from {@code onActivityResult()}
  * @param resultCode result code from {@code onActivityResult()}
  * @param intent {@link Intent} from {@code onActivityResult()}
  * @return null if the event handled here was not related to this class, or else an {@link
  *     IntentResult} containing the result of the scan. If the user cancelled scanning, the fields
  *     will be null.
  */
 public static IntentResult parseActivityResult(int requestCode, int resultCode, Intent intent) {
   if (requestCode == REQUEST_CODE) {
     if (resultCode == Activity.RESULT_OK) {
       String contents = intent.getStringExtra(Intents.Scan.RESULT);
       String formatName = intent.getStringExtra(Intents.Scan.RESULT_FORMAT);
       byte[] rawBytes = intent.getByteArrayExtra(Intents.Scan.RESULT_BYTES);
       int intentOrientation =
           intent.getIntExtra(Intents.Scan.RESULT_ORIENTATION, Integer.MIN_VALUE);
       Integer orientation = intentOrientation == Integer.MIN_VALUE ? null : intentOrientation;
       String errorCorrectionLevel =
           intent.getStringExtra(Intents.Scan.RESULT_ERROR_CORRECTION_LEVEL);
       String barcodeImagePath = intent.getStringExtra(Intents.Scan.RESULT_BARCODE_IMAGE_PATH);
       return new IntentResult(
           contents, formatName, rawBytes, orientation, errorCorrectionLevel, barcodeImagePath);
     }
     return new IntentResult();
   }
   return null;
 }
Esempio n. 30
0
  @Override
  protected void onNewIntent(Intent intent) {
    final Intent inte = intent;
    Toast.makeText(
            this,
            ByteArrayToHexString(intent.getByteArrayExtra(NfcAdapter.EXTRA_ID)),
            Toast.LENGTH_LONG)
        .show();
    new Thread(
            new Runnable() {
              @Override
              public void run() {
                new ServerCommunicator()
                    .aankoop(ByteArrayToHexString(inte.getByteArrayExtra(NfcAdapter.EXTRA_ID)));
              }
            })
        .start();

    super.onNewIntent(intent);
  }