Android NFC premier plan de répartition problème

je suis complètement nouvelle pour android, le développement et ont à écrire une simple application pour la lecture d'un tag nfc (avec la nexus s) pour l'université.

mon problème est que lorsque la nexus discoveres une balise, mon application n'est pas répertorié dans les "sélectionner une action"-popup. le but est de lire les étiquettes à l'aide de l'arrière-plan de répartition méthode décrite en http://developer.android.com/guide/topics/nfc/index.html
et
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/nfc/ForegroundDispatch.html

je pense qu'il y a quelque chose qui manque dans le manifeste, mais je ne sais pas quoi.
voici le manifeste:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.iforge.android.nfc"
>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<application
    android:icon="@drawable/icon"
    android:label="@string/app_name"
>
<activity android:name=".simulator.FakeTagsActivity"
    android:theme="@android:style/Theme.NoTitleBar">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>

</activity>

    <activity android:name="TagViewer"
        android:theme="@android:style/Theme.NoTitleBar"
    >
        <intent-filter>
            <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
            <data android:mimeType="mime/type" />
        </intent-filter>

        <intent-filter>
            <action android:name="android.nfc.action.TECH_DISCOVERED"/>

        </intent-filter>

        <intent-filter>
            <action android:name="android.nfc.action.TAG_DISCOVERED"/>
        </intent-filter>
    </activity>
</application>
<uses-sdk android:minSdkVersion="10" />
<uses-feature android:name="android.hardware.nfc" android:required="true" />

voici le code de l'activité qui doit être appelée lorsqu'une balise est découvert (ce qui est construit à partir de l'android NFCDemo ainsi que la ForegroundDispatch-exemple):

public class TagViewer extends Activity 
{
WebView webView;
private NfcAdapter mAdapter;
private PendingIntent mPendingIntent;
private IntentFilter[] mFilters;
private String[][] mTechLists;
@Override
protected void onCreate(Bundle savedInstanceState) 
{
super.onCreate(savedInstanceState);
mAdapter = NfcAdapter.getDefaultAdapter(this);
mPendingIntent = PendingIntent.getActivity(
this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
try {
ndef.addDataType("*/*");    /* Handles all MIME based dispatches. 
You should specify only the ones that you need. */
}
catch (MalformedMimeTypeException e) {
throw new RuntimeException("fail", e);
}
mFilters = new IntentFilter[] {
ndef,
};
mTechLists = new String[][] { new String[] { NfcF.class.getName() } };
setContentView(R.layout.tag_viewer);
webView = (WebView) findViewById(R.id.webView1);
webView.getSettings().setJavaScriptEnabled(true); 
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
webView.getSettings().setPluginsEnabled(false);
webView.getSettings().setSupportMultipleWindows(false);
webView.getSettings().setSupportZoom(false);
webView.setVerticalScrollBarEnabled(false);
webView.setHorizontalScrollBarEnabled(false);
resolveIntent(getIntent());
}
@Override
public void onResume() {
super.onResume();
mAdapter.enableForegroundDispatch(this, mPendingIntent, mFilters, mTechLists);
}
@Override
public void onPause() {
super.onPause();
mAdapter.disableForegroundDispatch(this);
}
void resolveIntent(Intent intent) 
{
//Parse the intent
String action = intent.getAction();
if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)) 
{
//When a tag is discovered we send it to the service to be save. We
//include a PendingIntent for the service to call back onto. This
//will cause this activity to be restarted with onNewIntent(). At
//that time we read it from the database and view it.
Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
NdefMessage[] msgs;
if (rawMsgs != null) 
{
msgs = new NdefMessage[rawMsgs.length];
for (int i = 0; i < rawMsgs.length; i++) 
{
msgs[i] = (NdefMessage) rawMsgs[i];
}
} 
else 
{
//Unknown tag type
byte[] empty = new byte[] {};
NdefRecord record = new NdefRecord(NdefRecord.TNF_UNKNOWN, empty, empty, empty);
NdefMessage msg = new NdefMessage(new NdefRecord[] {record});
msgs = new NdefMessage[] {msg};
}
//Setup the web-view
setUpWebView(msgs);
} 
else 
{
Log.e("ViewTag", "Unknown intent " + intent);
finish();
return;
}
}
void setUpWebView(NdefMessage[] msgs) 
{
if (msgs == null || msgs.length == 0) return;
String urlToLoad = MessageParser.parseMessage(msgs[0]);
if(!urlToLoad.matches("")) webView.loadUrl(urlToLoad);
}
@Override
public void onNewIntent(Intent intent) 
{
setIntent(intent);
resolveIntent(intent);
Log.i("Foreground dispatch", "Discovered tag with intent: " + intent);
}
}

j'ai essayé beaucoup de choses, mais rien ne fonctionne. il serait génial si quelqu'un peut me dire ce que je suis absent. je suis en cours d'exécution hors du temps 🙁

veuillez

grâce

InformationsquelleAutor user746776 | 2011-05-10