diff --git a/apps/Tag/AndroidManifest.xml b/apps/Tag/AndroidManifest.xml
index ae198a339..3388a3031 100644
--- a/apps/Tag/AndroidManifest.xml
+++ b/apps/Tag/AndroidManifest.xml
@@ -31,6 +31,12 @@
+
+
+
+
+
+
diff --git a/apps/Tag/src/com/android/apps/tag/TagBroadcastReceiver.java b/apps/Tag/src/com/android/apps/tag/TagBroadcastReceiver.java
new file mode 100644
index 000000000..015e897ad
--- /dev/null
+++ b/apps/Tag/src/com/android/apps/tag/TagBroadcastReceiver.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.apps.tag;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.widget.Toast;
+import com.trustedlogic.trustednfc.android.NdefMessage;
+import com.trustedlogic.trustednfc.android.NdefRecord;
+import com.trustedlogic.trustednfc.android.NfcManager;
+
+/**
+ * This class doesn't work. Sorry. Think of this class as pseudo
+ * code for now.
+ */
+public class TagBroadcastReceiver extends BroadcastReceiver {
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction().equals(NfcManager.NDEF_TAG_DISCOVERED_ACTION)) {
+ NdefMessage msg = intent.getParcelableExtra(NfcManager.NDEF_MESSAGE_EXTRA);
+ Toast.makeText(context, "got a new message", Toast.LENGTH_SHORT).show();
+ insertIntoDb(msg);
+ }
+ }
+
+ private void insertIntoDb(NdefMessage msg) {
+ for (NdefRecord record : msg.getRecords()) {
+ insertIntoRecordDb(record.getType(), record.getPayload());
+ }
+ }
+
+ private void insertIntoRecordDb(byte[] type, byte[] payload) {
+ // do something...
+ }
+
+}
diff --git a/apps/Tag/src/com/android/apps/tag/TagList.java b/apps/Tag/src/com/android/apps/tag/TagList.java
index aa9d8d36d..f8a93e692 100644
--- a/apps/Tag/src/com/android/apps/tag/TagList.java
+++ b/apps/Tag/src/com/android/apps/tag/TagList.java
@@ -27,18 +27,17 @@ import android.view.Menu;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
-import com.trustedlogic.trustednfc.android.NfcManager;
+import android.widget.Toast;
/**
* @author nnk@google.com (Nick Kralevich)
*/
public class TagList extends ListActivity implements DialogInterface.OnClickListener {
- private NfcManager mManager;
-
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ Toast.makeText(getBaseContext(), "entered method", Toast.LENGTH_SHORT).show();
SQLiteDatabase db = new TagDBHelper(this.getBaseContext()).getReadableDatabase();
Cursor c = db.query("Tags", new String[] { "_id", "description" }, null, null, null, null, null);
@@ -51,6 +50,9 @@ public class TagList extends ListActivity implements DialogInterface.OnClickList
setListAdapter(sca);
registerForContextMenu(getListView());
+ c.close();
+ db.close();
+ Toast.makeText(getBaseContext(), "exit method", Toast.LENGTH_SHORT).show();
}
@Override
diff --git a/apps/Tag/tests/AndroidManifest.xml b/apps/Tag/tests/AndroidManifest.xml
index f4e79ed34..63ef9e3f4 100644
--- a/apps/Tag/tests/AndroidManifest.xml
+++ b/apps/Tag/tests/AndroidManifest.xml
@@ -15,7 +15,7 @@
-->
+ package="com.android.apps.tag.tests">