title: Android HCE: are there rules for AID?
body: <p>I'm trying to use an ACR122 NFC reader to select an application emulated in
  one Nexus 5 using Android Host Card Emulation. However, small AIDs are not
  recognized.</p>
  
  <p>My goal is to use a three byte long AID, as I do in a DESfire card. My first goal
  is only to be able to do a SELECT command.</p>
  
  <p>My test app uses the following configuration for AIDs:</p>
  
  <pre><code>&lt;host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
  android:description="@string/service_descr"
  android:requireDeviceUnlock="false" &gt;
  
      &lt;aid-group
          android:category="other"
          android:description="@string/aid_descr" &gt;
              &lt;aid-filter android:name="A0A1A2" /&gt;
              &lt;aid-filter android:name="B0B1B2B3" /&gt;
              &lt;aid-filter android:name="C0C1C2C3C4" /&gt;
              &lt;aid-filter android:name="D0D1D2D3D4D5" /&gt;
              &lt;aid-filter android:name="E0E1E2E3E4E5E6" /&gt;
      &lt;/aid-group&gt;
  
  &lt;/host-apdu-service&gt;
  </code></pre>
  
  <p>If I run the following APDUs:</p>
  
  <pre><code>00 a4 04 00 03 a0 a1 a2 00
  00 a4 04 00 04 b0 b1 b2 b3 00
  00 a4 04 00 05 c0 c1 c2 c3 c4 00
  00 a4 04 00 06 d0 d1 d2 d3 d4 d5 00
  00 a4 04 00 07 e0 e1 e2 e3 e4 e5 e6 00
  </code></pre>
  
  <p>I always get the following responses:</p>
  
  <pre><code>=&gt; 00 a4 04 00 03 a0 a1 a2 00 
  &lt;= 6f 00 
  =&gt; 00 a4 04 00 04 b0 b1 b2 b3 00 
  &lt;= 6a 82 
  =&gt; 00 a4 04 00 05 c0 c1 c2 c3 c4 00 
  &lt;= 90 00 
  =&gt; 00 a4 04 00 06 d0 d1 d2 d3 d4 d5 00 
  &lt;= 90 00 
  =&gt; 00 a4 04 00 07 e0 e1 e2 e3 e4 e5 e6 00 
  &lt;= 90 00 
  </code></pre>
  
  <p>So, only AIDs with length greater than 5 bytes will work with Android? Or am I
  doing something really wrong?</p>