ISO B カードを読み取るための簡単なアプリを作成する必要があります
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tag_viewer);
mTagContent = (LinearLayout) findViewById(R.id.list);
mTitle = (TextView) findViewById(R.id.title);
resolveIntent(getIntent());
}
void resolveIntent(Intent intent) {
// Parse the intent
String action = intent.getAction();
Log.e(TAG, "toto ");
if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)) {
try{
myTag.connect();
if (myTag.isConnected()){
byte[] response = myTag.transceive(command);
//logText(new String(response));
Log.e(TAG, "Result " + response);
}
myTag.close();
}catch (IOException e) {
e.printStackTrace();
}
} else {
Log.e(TAG, "Unknown intent " + intent);
finish();
return;
}
}
私の問題は、(NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)) の場合にテストに参加できないことです。私は体系的に「未知の意図」を持っています。
マニフェストについて:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.nfc">
<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="TagViewer"
android:theme="@android:style/Theme.NoTitleBar"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<meta-data android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/nfc_tech_filter" />
</activity>
</application>
<uses-sdk android:minSdkVersion="9" />
<uses-feature android:name="android.hardware.nfc" android:required="true" />
ご協力いただきありがとうございます。