Monday 15 April 2013

android - How to receive NFC tag data with my activity not foregound -



android - How to receive NFC tag data with my activity not foregound -

i'm developing nfc application turn wifi on , connect specific network when nfc tag tapped. far, i've understood nfc activity should on foreground nfc info android system. but, uncertainty whether understanding right or not, since i've seen operation of nfc tasks(https://play.google.com/store/apps/details?id=com.wakdev.nfctasks). although application not activated on receiving nfc data, launching corresponding task , turning wifi on successfully.

i'd know how possible. there can explain operation?

thanks in advance.

logcat on tapping nfc tag made 'nfc tools' : i/nfcdispatcher(822): matched aar ndef : e/soundpool(822): don`t play soundpool when not normal mode : e/nfcservice(822): applyalternativehandler::unknown message received : i/activitymanager(553): start {act=android.nfc.action.ndef_discovered typ=w1/33 pkg=com.wakdev.nfctasks cmp=com.wakdev.nfctasks/.nfcactivity (has extras) u=0} pid 822

logcat on tapping nft tag made application : i/nfcdispatcher(822): matched aar application launch : e/soundpool(822): don`t play soundpool when not normal mode : e/nfcservice(822): applyalternativehandler::unknown message received : i/activitymanager(553): start {act=android.intent.action.main cat=[android.intent.category.launcher] flg=0x10000000 pkg=com.farraf.digitalsignage cmp=com.farraf.digitalsignage/.main.digitalsignageactivity u=0} pid 822 : i/activitymanager(553): start proc com.farraf.digitalsignage activity com.farraf.digitalsignage/.main.digitalsignageactivity: pid=10160 uid=10008 gids={3003, 1015, 1028}

besides receiving nfc tag events trhough foreground dispatch scheme (see foreground dispatch system), can register activities launched upon , receive nfc events through androidmanifest.xml of app (see filtering nfc intents). e.g. if nfc tag contains uri http://www.example.com/, create intent filter this:

<activity ...> <intent-filter> <action android:name="android.nfc.action.ndef_discovered"/> <category android:name="android.intent.category.default"/> <data android:scheme="http" android:host="www.example.com" /> </intent-filter> </activity>

android android-intent nfc launcher ndef

No comments:

Post a Comment