Imported Upstream version 1.1.0
[platform/upstream/iotivity.git] / android / examples / simpleserver / src / main / java / org / iotivity / base / examples / SimpleServer.java
index 2dbd033..707e1a1 100644 (file)
@@ -27,6 +27,7 @@ import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.nfc.NfcAdapter;
 import android.os.Bundle;
 import android.text.method.ScrollingMovementMethod;
 import android.util.Log;
@@ -64,6 +65,7 @@ public class SimpleServer extends Activity {
         Context context = this;
 
         PlatformConfig platformConfig = new PlatformConfig(
+                this,
                 context,
                 ServiceType.IN_PROC,
                 ModeType.SERVER,
@@ -242,4 +244,17 @@ public class SimpleServer extends Activity {
             msg(message);
         }
     }
+
+    @Override
+    public void onNewIntent(Intent intent) {
+        super.onNewIntent(intent);
+        Log.d(TAG, "onNewIntent with changes sending broadcast IN ");
+
+        Intent i = new Intent();
+        i.setAction(intent.getAction());
+        i.putExtra(NfcAdapter.EXTRA_NDEF_MESSAGES,
+                intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES));
+        sendBroadcast(i);
+        Log.d(TAG, "Initialize Context again resetting");
+    }
 }