Hallo,

> And Tech_Discovered:
> <intent-filter>
>  <action android:name="android.nfc.action.TECH_DISCOVERED">
> <meta-data android:name="android.nfc.action.TECH_DISCOVERED"
> android:resource="@xml/nfc_tech_filter" />
> </action></intent-filter>

This intent filter seems to be wrong. The meta-data should be placed
as a subelement of the <activity> (just on the same level as the
intent filter).

This also seems to be a bug in the documentation. (Actually there are
more mistakes on that page.)

So the correct intent-filter would look like this:
    <activity ... >
      <!-- Catch tag detection events for specific technologies -->
      <intent-filter>
        <action android:name="android.nfc.action.TECH_DISCOVERED" />
      </intent-filter>
      <meta-data android:name="android.nfc.action.TECH_DISCOVERED"
                 android:resource="@xml/filter_nfc" />
    </activity>

> My first question is: Are this definitions enough to get the App shown
> in the TechListOverView?

To get your activity in the activity chooser, you must also correctly
setup your @xml/nfc_tech_filter xml resource. If you want to be
sensitive to the NfcA technology, your tech-filter would look like
this:

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
  <tech-list>
    <tech>android.nfc.tech.NfcA</tech>
  </tech-list>
</resources>

If you want to be sensitive to all Mifare Ultralight tags that are
also NfcA technology, your filter would look like this:
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
  <tech-list>
    <tech>android.nfc.tech.NfcA</tech>
    <tech>android.nfc.tech.MifareUltralight</tech>
  </tech-list>
</resources>

Btw, in this case it would have been enough to use the
MifareUltralight tech filter alone, as *all* Mifare Ultralights are
NfcA anyways.

If you want to be sensitive to all NfcA tags and all NfcB tags, your
tech-filter would look like this:

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
  <tech-list>
    <tech>android.nfc.tech.NfcA</tech>
  </tech-list>
  <tech-list>
    <tech>android.nfc.tech.NfcB</tech>
  </tech-list>
</resources>

Notice two things here:
1. The documentation is wrong in saying that each tech-list is to be
surrounded with <resources> tags. (The compiler will throw an error on
this.)
2. Putting multiple <tech>s inside one <tech-list> give the logical
AND between the techs and putting mutiple <tech-list>s inside the
filter xml-file gives the logical OR between the tech-lists.

br,
Michael

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to