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

Did we domesticate cats, or did cats domesticate us?

This year is the Year of the Tiger. So let’s talk...

Can traffic to Douyin store only come from the homepage?

After opening a small store on Douyin , many busi...

The legendary snail that disappeared for a century reappears in the world!

Recently, Chinese researchers discovered sessile ...

Game Creator game template competition opens, let's make game directors together

In order to provide developers with more game typ...

Wafangdian SEO Training: What are the basic steps for Baidu ranking?

A program that searches and crawls the Internet i...

Canada has ordered Bitcoin ATMs and plans to roll them out in early October

[September 10 news] Bitcoiniacs, a Bitcoin exchan...

Why do Android phones get slower and slower with 6G memory?

Nowadays, mobile phones have 3 to 4G memory and th...

One article to solve the search advertising problems on Toutiao and Baidu

There are already many articles and tutorials on t...

Product Operations: How to Develop a Growth Plan for Your Product!

After the concept of growth hacking was introduce...

In a county town in Henan, diamonds are sold like cabbages? They are grown!

At the beginning of this year, the cultural and t...