What I want to be able to do is have an NFC tag that launches my app
if it is installed, or launches directly to the Android Marketplace if
the app is not installed.

I've successfully programmed a tag with a market URL, e.g.
market://details?id=com.my.package.name. When the tag is read
(Gingerbread 2.3.6), it will run the market app and go directly to the
application's details page.

I then tried various combinations of intent-filters. The closest I was
able to get was:

<intent-filter>
    <action android:name="android.nfc.action.NDEF_DISCOVERED" />
    <category android:name="android.intent.category.DEFAULT"/>
    <data android:scheme="market" android:host="details" />
</intent-filter>

However, this only gave my application parity with the Marketplace,
i.e. it pops up the "choose app" list when scanning the tag, offering
the Market app and my app as the handlers.

In working with the android.net.Uri class, and having it parse the
market URL, I find that this form of URL parses to:
scheme: market
host: details
path: null
query: id=com.my.package.name

Unfortunately, I don't see anything in the <data> tag documentation to
allow us to specify the query as part of the intent filter.

I know that I can put a URL that is under my control that would
redirect to the Market...but that would require the user to select the
tag once it's been collected by the default Tags app...though with the
0-click ICS demos at Google IO, I would presume that this might be
effective.

The Google IO Fruit Ninja demo shows something similar to what I want
to do, but there it seems that they are using foreground Ndef Push to
push the market URL and then entering P2P from there.

- John

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

Reply via email to