Any update on the <category> question answer please? - dave
On Feb 24, 5:36 pm, Nick Pelly <[email protected]> wrote: > On Wed, Feb 23, 2011 at 7:26 PM, davemac <[email protected]> wrote: > > I hate to seem like a nag on this topic, but I've got some more > > concerns about the documentation, and your answer. Let's consider an > > example as described in the reference page for NfcAdapter, which seems > > to be more correct than the DevGuide for NFC: > > > <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> > > <!-- capture anything using NfcF --> > > <tech-list> > > <tech>android.nfc.tech.NfcF</tech> > > </tech-list> > > > <!-- OR --> > > > <!-- capture all MIFARE Classics with NDEF payloads --> > > <tech-list> > > <tech>android.nfc.tech.NfcA</tech> > > <tech>android.nfc.tech.MifareClassic</tech> > > <tech>android.nfc.tech.Ndef</tech> > > </tech-list> > > </resources> > > > If I have a tag that enumerates NfcA and MifareClassic but does not > > enumerate Ndef, I'm assuming that this activity would not receive that > > NFC tech intent. Correct? > > Correct. The tag is neither NfcF OR (NfcA AND MifareClassic AND Ndef) > > > None of the intent-filter's tech-list sets > > is a subset of > > Tag.getTechList(). > > > If I have a tag that enumerates NfcF and Ndef, I'm assuming that this > > activity *would* receive that NFC tech intent, right? The intent- > > filter tech-list of NfcF *is* a sub-set of Tag.getTechList(). Correct? > > correct > > > > > And this jives with your earlier answer about not having to specify > > both MifareUltralight *and* NfcA in a tech-list since if the tech-list > > has both and my tech-list only has one, it's still a sub-set so it > > will match. It could actually be dangerous to specify both in case > > some tag doesn't enumerate NfcA, then the tech-list would not be a sub- > > set of the Tag's tech list so there'd be no match. > > correct > > > > > Just one more thing about the <category> tag with the intent filters > > for NFC tags. In the NFCDemo, for the intent-filter for TAG_DISCOVERED > > there is a <category> tag within the <intent-filter>, as one would > > expect in order to receive an intent that carries no data. This > > <category> tag is not present in the NfcAdapter reference page or the > > NFC DevGuide page, but I think it should be. Correct? > > we're looking into this. > > > > > What I can't tell is whether or not the <category> tag is required > > within the <intent-filter> when the action is TECH_DISCOVERED. I > > haven't been able to figure out the bytes to generate a fake non-Ndef > > tag to send from FakeTagsActivity. And when I save my manifest.xml > > file either way, I get no errors. > > > I appreciate any help that I can get. Thanks! > > > - dave > > > On Feb 23, 1:01 pm, Nick Pelly <[email protected]> wrote: > > > On Wed, Feb 23, 2011 at 8:45 AM, davemac <[email protected]> wrote: > > > > What you're saying doesn't jive with the documentation, which says the > > > > following (onhttp://developer.android.com/guide/topics/nfc/index.html > > ): > > > > > Specifiying [sic] multiple technologies within the same list tells the > > > > system to filter tags that support all of the technologies. > > > > This particular sentence is a little confusing in the docs, i'll try and > > > have it improved. > > > > > The > > > > example below never filters a tag because no tag supports all of the > > > > technologies at once. You can remove the ones that you do not need. > > > > The docs say a tag will only match if all tag technologies are listed > > > > in my tech-list, > > > > No the docs don't say that. > > > > There is a better explanation here, which matches with how I explained > > it, > > > which is how it is :) > > > >http://developer.android.com/reference/android/nfc/NfcAdapter.html#AC... > > > > """ > > > A tag matches if any of the tech-list sets is a subset of > > > Tag.getTechList()< > >http://developer.android.com/reference/android/nfc/Tag.html#getTechList() > > >. > > > Each of the tech-lists is considered independently and the activity is > > > considered a match is any single tech-list matches the tag that was > > > discovered. This provides AND and OR semantics for filtering desired > > techs. > > > """ > > > > and all tech-list technologies are implemented by the > > > > > tag. You're saying that the tag's technologies only need to match a > > > > sub-set of the tech-list. > > > > yes > > > > > Or are you saying that a MifareUltralight > > > > tag only reports MifareUltralight technology? > > > > No. > > > > > Or that the docs are > > > > wrong? > > > > No they're just a little confusing. > > > > > I have a related question that I hope you don't mind answering here as > > > > well. To build an intent filter in code that supports tech, how do you > > > > specify the techlists on it? Or does this only work in foreground > > > > dispatch mode? > > > > I am a little hazy on the details for this one, but I believe the best > > > practice is to define all the intent filters you might want in the > > manifest, > > > and then turn intent-filters on and off at run-time. > > > > > - dave > > > > > On Feb 23, 12:41 am, Nick Pelly <[email protected]> wrote: > > > > > On Tue, Feb 22, 2011 at 6:50 PM, davemac <[email protected]> > > wrote: > > > > > > I'm reading the documentation on NFC tags and intent filters to > > match > > > > > > on. For an action of ACTION_TECH_DISCOVERED, the intent filter must > > > > > > list the technologies to match on, using a filter file. What I > > wanted > > > > > > clarification on is whether or not I need to also specify for > > example > > > > > > NfcA when I'm looking for a Mifare Utralight tag. > > > > > > > For the Mifare Ultralight tag, the documentation says this: > > > > > > NfcA will also be enumerated on the tag, because all MIFARE > > Ultralight > > > > > > tags are also NfcA tags. > > > > > > > This suggests to me that my XML filter file should say 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> > > > > > > > because if the tag is enumerating NfcA in addition to > > > > > > MifareUltralight, my intent filter will only match if I specify > > both > > > > > > technologies, not just MifareUltralight. Is that true? This applies > > to > > > > > > IsoDep as well, which enumerates both NfcA and NfcB, in which case > > I > > > > > > would need to specify all three. True? I don't have available > > hardware > > > > > > to test this for myself. Thanks for your help. > > > > > > You do not need to specify both NfcA and MifareUltralight. You can > > just > > > > > specify MifareUltralight. The <tech-list> only requires a subset of > > > > tech's > > > > > in order to match. > > > > > > In the case of MIFARE Ultralight, it happens to always be based on > > NfcA > > > > > technology. So tags with the MifareUltralight tech will always also > > have > > > > the > > > > > NfcA tech. So there is no harm also putting NfcA in the <tech-list>. > > But > > > > it > > > > > is not strictly required. > > > > > > Nick > > > > > -- > > > > 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 > > > -- > > 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 -- 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

