Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

Question:Android NFC App not pushing Ndef messages

I am working on creating an Android App that uses NFC to register touches from device to device. I am using two Nexus 7s for testing.

Ideal use case is to have the App active on one device, not active on the other. The active device pushes an NdefMessage with a record containing some data for the passive device app to deal with. The passive device passes a recording containing some data back to the active app.

I have the following intent filters set up in my manifest:

   android:name=".MainActivity" android:label="@string/title_activity_main">

In my MainActivity I have the following in onCreate to set up the NFC adapter:

mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
PendingIntent pendingIntent = PendingIntent.getActivity(
            this, 0, new Intent(this,
                getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
mNfcPendingIntent = pendingIntent;
    // Intent filters for exchanging over p2p.
if(mNfcAdapter != null){
    IntentFilter ndefDetected = new
    IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
    try {
    catch (MalformedMimeTypeException e) {
        throw new RuntimeException("fail", e);
    this.intentFiltersArray = new IntentFilter[] {ndef, };
    Log.d(this.toString(), "mNfcPendingIntent: ");
    mNdefExchangeFilters = new IntentFilter[] { ndefDetected,defendDetected };



asked Sep 13, 2013 in Core java by rajesh
edited Sep 12, 2013
0 votes

Related Hot Questions

Government Jobs Opening