NFC interface adaptation, reading and writing tags (Note and Galaxy series)

NFC interface adaptation, reading and writing tags (Note and Galaxy series)

Source code introduction

For NFC models, you can read and write tags.
Source code running screenshot

y

Source code snippet

  1. /Write content
  2. toWBtn=(Button)findViewById(R.id.toWBtn);
  3. toWBtn.setOnClickListener( new OnClickListener() {
  4. @Override  
  5. public   void onClick(View arg0) {
  6. // TODO Auto-generated method stub  
  7. Intent intent= new Intent(MainActivity. this ,Write2Nfc. class );
  8. startActivity(intent);
  9. }
  10. });
  11. //NFC adapter, all NFC operations are performed from this adapter  
  12. nfcAdapter = NfcAdapter.getDefaultAdapter( this );
  13. if (!ifNFCUse()){
  14. return ;
  15. }
  16. //The Intent to be called, used to repeat the jump to be executed after being triggered by the Intent  
  17. pendingIntent = PendingIntent.getActivity( this , 0 , new Intent( this ,
  18. getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0 );
  19. //Set the tag action to be filtered. Only ACTION_NDEF_DISCOVERED type is accepted here.  
  20. ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
  21. ndef.addCategory( "*/*" );
  22. mFilters = new IntentFilter[] { ndef }; // Filter  
  23. mTechLists = new String[][] { new String[] { NfcA. class .getName() },
  24. new String[] { NfcF. class .getName() },
  25. new String[] { NfcB. class .getName() },
  26. new String[] { NfcV. class .getName() } }; // Tag types allowed to be scanned  
  27.          

Source code link: http://download..com/data/1978596

<<:  BlackBerry CEO: It's unfair that Apple doesn't develop apps for us

>>:  Nine-grid password lock entry program

Recommend

Money comes in but cars are not produced: Internet car companies are in trouble

Since the beginning of this year, Tesla, the worl...

Keep product experience report, tell you the secret of user growth

1. Experience the environment Test model: iPhone6...

Tik Tok account promotion strategy for restaurant franchise!

We live in the colorful 21st century. With the co...

Tools that make programmers lazy: Jenkins + Dandelion

About laziness I often see many blogs saying that...

User operation strategy of “Get” App!

In the knowledge payment industry, Dedao has alwa...