CopyPastor

Detecting plagiarism made easy.

Score: 1.8482880423451904; Reported for: String similarity, Exact paragraph match Open both answers

Possible Plagiarism

Reposted on 2015-02-17
by Md. Sajedul Karim

Original Post

Original - Posted on 2015-02-17
by Md. Sajedul Karim



            
Present in both answers; Present only in the new answer; Present only in the old answer;

First of all You have to get permission in AndroidMenifest.xml File for nfc. The permissions are:
<uses-permission android:name="android.permission.NFC" />
<uses-feature android:name="android.hardware.nfc" /> The Activity which will perform Nfc Read/write operation , add this intent filter in that activity in menifest.xml file:
<intent-filter> <action android:name="android.nfc.action.TAG_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" /> </intent-filter> In your activity onCreate() method you have to initialize the NFC adapter and define Pending Intent :
NfcAdapter mAdapter; PendingIntent mPendingIntent; mAdapter = NfcAdapter.getDefaultAdapter(this); if (mAdapter == null) { //nfc not support your device. return; } mPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); In onResume() Call back enable the Foreground Dispatch to detect NFC intent.
mAdapter.enableForegroundDispatch(this, mPendingIntent, null, null); In onPause() callback you must have to disable the forground dispatch:
if (mAdapter != null) { mAdapter.disableForegroundDispatch(this); } In onNewIntent() call back method you will get the new Nfc Intent. After getting The Intent , you have to parse the intent to detect the card:
@Override protected void onNewIntent(Intent intent){ getTagInfo(intent) } private void getTagInfo(Intent intent) { Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); } Now You have the Tag. Then you can check the Tag Tech list to detect that Tag. The tag detection technique is here in [My Another Answer][1] Full Project is in [My GitHub Repo][2]

[1]: https://stackoverflow.com/a/28565383/3073945 [2]: https://github.com/mesuk08/NFC-UTILS
First of all you have to get permission in AndroidManifest.xml file for NFC. The permissions are:
<uses-permission android:name="android.permission.NFC" /> <uses-feature android:name="android.hardware.nfc" />
The Activity which will perform NFC Read/write operation, add this intent filter in that activity in AndroidManifest.xml file: <intent-filter> <action android:name="android.nfc.action.TAG_DISCOVERED" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>
In your activity onCreate() method you have to initialize the NFC adapter and define Pending Intent :
NfcAdapter mAdapter; PendingIntent mPendingIntent; mAdapter = NfcAdapter.getDefaultAdapter(this); if (mAdapter == null) { //nfc not support your device. return; } mPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); In onResume() Call back enable the Foreground Dispatch to detect NFC intent.
mAdapter.enableForegroundDispatch(this, mPendingIntent, null, null); In onPause() callback you must have to disable the forground dispatch:
if (mAdapter != null) { mAdapter.disableForegroundDispatch(this); } In onNewIntent() call back method you will get the new Nfc Intent. After getting The Intent , you have to parse the intent to detect the card:
@Override protected void onNewIntent(Intent intent){ getTagInfo(intent) } private void getTagInfo(Intent intent) { Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); }
Now You have the Tag. Then you can check the Tag Tech list to detect that Tag. The tag detection technique is here in [My Another Answer][1] Full complete project is here in [My github profile][2]

[1]: https://stackoverflow.com/a/28565383/3073945 [2]: https://github.com/mesuk08/NFC-UTILS

        
Present in both answers; Present only in the new answer; Present only in the old answer;