I save the AAR on my NFC-Tag. If I scan the TAG with the Nexus S (Android 4.1.1), i get the NfcAdapter.ACTION_NDEF_DISCOVERED and the NFCReaderActivity directly starts.
If I do the same with the HTC X (Android 4.0.3), the application starts but I just get the android.intent.action.MAIN and so the NFCReaderActivity doesn't show up and the Tag isn't scanned.
This works on Samsung Nexus S but not on HTC:
<activity android:name=".activities.NFCWriterActivity"></activity>
<activity android:name=".activities.NFCReaderActivity">
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:name=".activities.NFCBeamActivity">
</activity>
<activity android:name=".activities.WifiManagerActivity"></activity>
<activity android:name=".activities.WifiConfiguratorActivity"></activity>
<activity android:name=".activities.TagWriterOptionsActivity"></activity>
<activity android:name=".activities.WifiScannerTagActivity"></activity>
<activity android:name=".activities.WifiScannerActivity"></activity>
<activity android:name=".activities.WifiListActivity">
</activity>
This are my activities and filters.
Someone an idea?
Edit:
This works on HTC but not on Samsung Nexus S:
<activity android:name=".activities.NFCWriterActivity"></activity>
<activity android:name=".activities.NFCReaderActivity">
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="application/vnd.wfa.wsc" />
</intent-filter>
</activity>
<activity android:name=".activities.NFCBeamActivity">
</activity>
<activity android:name=".activities.WifiManagerActivity"></activity>
<activity android:name=".activities.WifiConfiguratorActivity"></activity>
<activity android:name=".activities.TagWriterOptionsActivity"></activity>
<activity android:name=".activities.WifiScannerTagActivity"></activity>
<activity android:name=".activities.WifiScannerActivity"></activity>
<activity android:name=".activities.WifiListActivity"></activity>
Here I got the following Exception @ HTC - maybe this is the Problem i don'tknow: Stack:
D/AudioTrack( 3938): stop 0x1601940
D/AudioFlinger( 142): releasing 231 from 3938
D/AudioTrack( 3938): AudioTrack destructor X
D/power ( 277): Already locked performance.
W/CpuWake ( 277): >>acquireCpuPerfWakeLock!
W/CpuWake ( 277): <<acquireCpuPerfWakeLock!
E/ActivityManager( 277): startLaunchActivity get appname failed
E/ActivityManager( 277): java.lang.NullPointerException
E/ActivityManager( 277): at com.android.server.am.ActivityStack.startLaunchActivity(ActivityStack.java:4831)
E/ActivityManager( 277): at com.android.server.am.ActivityStack.startActivityMayWait(ActivityStack.java:3352)
E/ActivityManager( 277): at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:2509)
E/ActivityManager( 277): at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:131)
E/ActivityManager( 277): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1751)
E/ActivityManager( 277): at android.os.Binder.execTransact(Binder.java:338)
E/ActivityManager( 277): at dalvik.system.NativeStart.run(Native Method)
I/ActivityManager( 277): START {act=android.nfc.action.NDEF_DISCOVERED typ=application/vnd.wfa.wsc pkg=at.nfc.wifi (has extras)} from pid 3938
W/ActivityManager( 277): Duplicate finish request for ActivityRecord{41163a90 com.android.nfc/.NfcRootActivity}
D/power ( 277): Already locked performance.
I/Intent ( 277): @test_code: getHtcIntentFlag: 0 obj: 1094379848
W/CpuWake ( 277): >>acquireCpuPerfWakeLock!
W/CpuWake ( 277): <<acquireCpuPerfWakeLock!
Maybe the Problem is the version 4.1.1 vs 4.0.3 - I don't know: Fact is: Only Ndef works on Samsung, If i add the
ACTION_TAG_DISCOVERED
and checking manually if it has NDEF on it or not. Might be awkward if you have other NFC apps though. – Lipson