private void resolveIntent(Intent data, boolean foregroundDispatch) { this.setIntent(data); scan = true; String action = data.getAction(); if ((data.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) { return; } if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)){ Tag tag = data.getParcelableExtra(NfcAdapter.EXTRA_TAG); Date now = new Date(); if (foregroundDispatch && (now.getTime() - last_scan.getTime()) > 10000) { //10000 = 10sec String[] techList = tag.getTechList(); String searchedTech = NfcV.class.getName(); // ###################### read Tag ###################### ProgressBar pb_scan; pb_scan = (ProgressBar)findViewById(R.id.pb_reading_spin); pb_scan.setVisibility(View.VISIBLE); new NfcVReaderTask(this).execute(tag); // ###################################################### } } }
private void setForegroundListener() { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); boolean handleFormatable = preferences.getBoolean("format_ndef_formatable_tags", false); pi = PendingIntent.getActivity(this, 0, new Intent(this,getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); intentFiltersArray = null; if(handleFormatable) techList = new String[][]{ new String[]{ NfcA.class.getName(),Ndef.class.getName()}, new String[]{ NfcB.class.getName(),Ndef.class.getName()}, new String[]{ NfcF.class.getName(),Ndef.class.getName()}, new String[]{ NfcV.class.getName(),Ndef.class.getName()}, new String[]{ NfcA.class.getName(),NdefFormatable.class.getName()}, new String[]{ NfcB.class.getName(),NdefFormatable.class.getName()}, new String[]{ NfcF.class.getName(),NdefFormatable.class.getName()}, new String[]{ NfcV.class.getName(),NdefFormatable.class.getName()}}; else techList = new String[][]{ new String[]{ NfcA.class.getName(),Ndef.class.getName()}, new String[]{ NfcB.class.getName(),Ndef.class.getName()}, new String[]{ NfcF.class.getName(),Ndef.class.getName()}, new String[]{ NfcV.class.getName(),Ndef.class.getName()}}; }
private void handleIntent(Intent intent) { String action = intent.getAction(); if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)) { Log.d("socialdiabetes", "NfcAdapter.ACTION_TECH_DISCOVERED"); // In case we would still use the Tech Discovered Intent Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); String[] techList = tag.getTechList(); String searchedTech = NfcV.class.getName(); new NfcVReaderTask().execute(tag); } }
/** * コンストラクタ * * @param nfcTag NFCTagへの参照をセット */ public ISO15693Tag(Tag nfcTag) { mNfcTag = nfcTag; NfcV nfcV = NfcV.get(mNfcTag); mDsfId = nfcV.getDsfId(); mUID = new UID(mNfcTag.getId()); }
public NfcIso15693(Tag tag) { nfcv = NfcV.get(tag); uid = tag.getId(); maxTranscieveLength = nfcv.getMaxTransceiveLength(); }
public static String load(Parcelable parcelable, Resources res) { final Tag tag = (Tag) parcelable; final IsoDep isodep = IsoDep.get(tag); Log.d("NFCTAG", "ffff");//isodep.transceive("45".getBytes()).toString()); if (isodep != null) { return PbocCard.load(isodep, res); } final NfcV nfcv = NfcV.get(tag); if (nfcv != null) { return VicinityCard.load(nfcv, res); } final NfcF nfcf = NfcF.get(tag); if (nfcf != null) { return OctopusCard.load(nfcf, res); } return null; }