title: Nexus 4 - NFC AAR and Filter
body: <p>I'm writing the Static Handover Select Record on a Tag with the Wifi Protected Setup Configuration as specified in the NFC Forum. (SSID, Encryption, ...).</p>
  
  <p>The type is <code>application/vnd.wfa.wsc</code></p>
  
  <p>Additionally I add the Android Application Record as last NDEF Record into my NDEF Message.</p>
  
  <p>I also have a filter defined in my Android Manifest XML for NFC Tags discovered.</p>
  
  <p>The problem is: If the application is launched and the Reader Activity is shown, I can read the tag and everything works fine.</p>
  
  <p>Now I want the following:
  If I scan my Tag, and the activity isn't @ foreground or not launched, the app should start itself and switch automatically into the reader mode.</p>
  
  <ol>
  <li>If I do that, the Nexus 4 doesn't launch by the AAR... It just starts, if i put this Record on the first place of the NDEF Message, but then I loose the event for the Ndef/Tech/Tag discovered.</li>
  <li>I also have the filter in my android manififest, but this seems not to do anything, I tried all three events but nothing happens</li>
  </ol>
  
  <p>Also, if the Tag is scanned, normally if more applications are filtering for the event, I get a app-selector, which app I want to start for this Tag. But my application is not listed here.</p>
  
  <p>This is how I create the message:</p>
  
  <pre><code>new NdefMessage(new NdefRecord[] { Utils.createHandoverSelectRecord(ac_record.toByteArray()), wpsRecord, aarRecord });
  </code></pre>
  
  <p>And here is the filter in my android manifest:</p>
  
  <pre><code>  &lt;activity android:name=".activities.NFCWriterActivity"&gt;&lt;/activity&gt;
          &lt;activity android:name=".activities.NFCReaderActivity" android:exported="true" android:permission="android.permission.NFC"&gt;
              &lt;intent-filter&gt;
                &lt;action android:name="android.nfc.action.TAG_DISCOVERED"/&gt;
                &lt;category android:name="android.intent.category.DEFAULT"/&gt;
              &lt;/intent-filter&gt;        
          &lt;/activity&gt;
          &lt;activity android:name=".activities.NFCBeamActivity"&gt;&lt;/activity&gt;
          &lt;activity android:name=".activities.WifiManagerActivity"&gt;&lt;/activity&gt;
          &lt;activity android:name=".activities.WifiConfiguratorActivity"&gt;&lt;/activity&gt;
          &lt;activity android:name=".activities.TagWriterOptionsActivity"&gt;&lt;/activity&gt;
          &lt;activity android:name=".activities.WifiScannerTagActivity"&gt;&lt;/activity&gt;
          &lt;activity android:name=".activities.WifiScannerActivity"&gt;&lt;/activity&gt; 
          &lt;activity android:name=".activities.WifiListActivity"&gt;&lt;/activity&gt;  
  
          &lt;activity
              android:name=".activities.MainActivity"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
              &lt;intent-filter&gt;
                &lt;action android:name="android.nfc.action.TAG_DISCOVERED"/&gt;
               &lt;!--  &lt;data android:mimeType="application/vnd.wfa.wsc" /&gt; --&gt;
                &lt;category android:name="android.intent.category.DEFAULT"/&gt;
              &lt;/intent-filter&gt;
              &lt;intent-filter&gt;
                &lt;action android:name="android.nfc.action.TECH_DISCOVERED"/&gt;
                &lt;category android:name="android.intent.category.DEFAULT"/&gt;
              &lt;/intent-filter&gt;
              &lt;intent-filter&gt;
                &lt;action android:name="android.nfc.action.NDEF_DISCOVERED"/&gt;
                &lt;category android:name="android.intent.category.DEFAULT"/&gt;
              &lt;/intent-filter&gt;                                
          &lt;/activity&gt;       
  
      &lt;/application&gt;
  </code></pre>
  
  <p>I don't really know where I should filter, I thought it would be enough to filter in the Reader Activity, but this didn't work, so I added the filters also in the MainActivity, but this also does nothing.</p>
  
  <p>I hope you can help me.</p>
  
  <p>Thanks!</p>