+++ /dev/null
-package org.average.nfcauthcr;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.PendingIntent;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.nfc.NfcAdapter;
-import android.nfc.Tag;
-import android.nfc.TagLostException;
-import android.nfc.tech.IsoDep;
-import android.util.Log;
-import android.widget.Toast;
-
-import org.average.nfcauthcr.NfcCRdispatch;
-
-public class TagEvent extends Activity {
-
- private final String TAG = getClass().getName();
-
- private NfcCRdispatch dispatch = new NfcCRdispatch((Activity)this);
-
- @Override
- protected void onResume() {
- super.onResume();
- Log.v(TAG, "Starting the work");
-
- new AlertDialog.Builder(this)
- .setTitle(R.string.challenging)
- .setMessage(R.string.swipe)
- .setOnCancelListener(
- new DialogInterface.OnCancelListener() {
- public void onCancel(DialogInterface dialog) {
- Log.v(TAG, "Cancel");
- finish();
- }
- })
- .create().show();
-
- Intent intent = getIntent();
- setResult(RESULT_CANCELED);
- byte[] challenge = intent.getByteArrayExtra("challenge");
- dispatch.onResume(challenge);
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- Log.v(TAG, "Finished the work");
-
- dispatch.onPause();
- }
-
- public void onNewIntent(Intent newintent) {
- Log.v(TAG, "NFC Intent arrived");
-
- byte[] response = dispatch.onNewIntent(newintent);
- if (response != null) {
- Intent masterintent = getIntent();
- masterintent.putExtra("response", response);
- setResult(RESULT_OK, masterintent);
- finish();
- }
- }
-}