Ability to launch Fake NFC (Near Field Communication)

I am working on Near Field Communication to read data from NFC tags. I do not have NFC supported by Android Mobile and NFC Tags to test the created application.

I want to know if it is possible to Launch my application through the intent filter (If it is assumed that an NFC tag has been detected on my device)

My manifest:

 <activity
        android:name=".ServerActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.nfc.action.NDEF_DISCOVERED" />

            <category android:name="android.intent.category.DEFAULT" />

            <data
                android:host="abc.com"
                android:pathPrefix="/aaap"
                android:scheme="http" />
        </intent-filter>
    </activity>

My Activity Snippet:

@Override
protected void onNewIntent(Intent intent) {
    if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())) {
        Toast.makeText(getApplicationContext(), "ACTION_TAG_DISCOVERED",
                Toast.LENGTH_LONG);
        Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
    }
}
+5
source share
3 answers

After some NFC research, I found that we can read / write NFC tags without an NFC-enabled device. But the answer is so simple. This is nothing but a game with intentions:

NFC:

    final Intent intent = new Intent(NfcAdapter.ACTION_TAG_DISCOVERED);
    intent.putExtra(NfcAdapter.EXTRA_NDEF_MESSAGES, "Custom Messages");
    startActivity(intent);

Android- , :

Manifest.xml

 <activity
        android:name="TagViewer" >
        <intent-filter>
            <action android:name="android.nfc.action.TAG_DISCOVERED" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
 </activity>

, , , .

:

TagViewer.java

    if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(getIntent().getAction())) {
        Log.v("NFC Launched","NFC Launched");           
    }

.

0

Open NFC. NFC simulator, Android. Android, BlackBerry.

EDIT:
4.4.1 Android ICS .

+1

I may have completely missed this point, but from what I understand, you basically want to remove the intention that will be chosen by the recipient that you stated in your manifest, right? Have you tried setting up a very simple test application that does just that using the method sendBroadcast(...)?

Intent exampleIntent = new Intent("android.nfc.action.NDEF_DISCOVERED");
sendBroadcast(exampleIntent)

You can add any additional data Intentin accordance with your requirements.

+1
source

All Articles