Added sample client and renamed sample server app
authorMarkus Jung <markus.jung@samsung.com>
Mon, 4 Jan 2016 23:01:34 +0000 (08:01 +0900)
committerUze Choi <uzchoi@samsung.com>
Thu, 7 Jan 2016 07:10:50 +0000 (07:10 +0000)
Change-Id: Ia9ed6f1397d96c513c6f7ce6ce61f32f1822d538
Signed-off-by: Markus Jung <markus.jung@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/4749
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
39 files changed:
service/resource-container/examples/android/ContainerSampleApp/RESampleServerApp.iml [deleted file]
service/resource-container/examples/android/RCSampleClientApp/README [moved from service/resource-container/examples/android/ContainerSampleApp/README with 100% similarity, mode: 0644]
service/resource-container/examples/android/RCSampleClientApp/app/app.iml [new file with mode: 0644]
service/resource-container/examples/android/RCSampleClientApp/app/build.gradle [new file with mode: 0644]
service/resource-container/examples/android/RCSampleClientApp/app/src/main/AndroidManifest.xml [new file with mode: 0644]
service/resource-container/examples/android/RCSampleClientApp/app/src/main/java/org/iotivity/service/sample/client/ContainerClientActivity.java [new file with mode: 0644]
service/resource-container/examples/android/RCSampleClientApp/app/src/main/java/org/iotivity/service/sample/client/Utils.java [new file with mode: 0644]
service/resource-container/examples/android/RCSampleClientApp/app/src/main/res/layout/activity_container_client.xml [new file with mode: 0644]
service/resource-container/examples/android/RCSampleClientApp/app/src/main/res/mipmap-hdpi/ic_launcher.png [moved from service/resource-container/examples/android/ContainerSampleApp/app/src/main/res/mipmap-hdpi/ic_launcher.png with 100% similarity, mode: 0644]
service/resource-container/examples/android/RCSampleClientApp/app/src/main/res/mipmap-mdpi/ic_launcher.png [moved from service/resource-container/examples/android/ContainerSampleApp/app/src/main/res/mipmap-mdpi/ic_launcher.png with 100% similarity, mode: 0644]
service/resource-container/examples/android/RCSampleClientApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png [moved from service/resource-container/examples/android/ContainerSampleApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png with 100% similarity, mode: 0644]
service/resource-container/examples/android/RCSampleClientApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png [moved from service/resource-container/examples/android/ContainerSampleApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png with 100% similarity, mode: 0644]
service/resource-container/examples/android/RCSampleClientApp/app/src/main/res/values-v21/styles.xml [moved from service/resource-container/examples/android/ContainerSampleApp/app/src/main/res/values-v21/styles.xml with 100% similarity, mode: 0644]
service/resource-container/examples/android/RCSampleClientApp/app/src/main/res/values/strings.xml [new file with mode: 0644]
service/resource-container/examples/android/RCSampleClientApp/app/src/main/res/values/styles.xml [new file with mode: 0644]
service/resource-container/examples/android/RCSampleClientApp/build.gradle [new file with mode: 0644]
service/resource-container/examples/android/RCSampleClientApp/settings.gradle [moved from service/resource-container/examples/android/ContainerSampleApp/settings.gradle with 100% similarity, mode: 0644]
service/resource-container/examples/android/RCSampleServerApp/RCSampleServerApp.iml [moved from service/resource-container/examples/android/ContainerSampleApp/ContainerSampleApp.iml with 70% similarity]
service/resource-container/examples/android/RCSampleServerApp/README [new file with mode: 0755]
service/resource-container/examples/android/RCSampleServerApp/app/app.iml [moved from service/resource-container/examples/android/ContainerSampleApp/app/app.iml with 97% similarity]
service/resource-container/examples/android/RCSampleServerApp/app/build.gradle [moved from service/resource-container/examples/android/ContainerSampleApp/app/build.gradle with 100% similarity]
service/resource-container/examples/android/RCSampleServerApp/app/src/main/AndroidManifest.xml [moved from service/resource-container/examples/android/ContainerSampleApp/app/src/main/AndroidManifest.xml with 100% similarity]
service/resource-container/examples/android/RCSampleServerApp/app/src/main/assets/lib/ResourceContainerConfig.xml [moved from service/resource-container/examples/android/ContainerSampleApp/app/src/main/assets/lib/ResourceContainerConfig.xml with 100% similarity]
service/resource-container/examples/android/RCSampleServerApp/app/src/main/java/org/iotivity/service/sample/container/ResourceContainer.java [moved from service/resource-container/examples/android/ContainerSampleApp/app/src/main/java/org/iotivity/service/sample/container/ResourceContainer.java with 100% similarity]
service/resource-container/examples/android/RCSampleServerApp/app/src/main/java/org/iotivity/service/sample/container/ResourceContainerActivity.java [moved from service/resource-container/examples/android/ContainerSampleApp/app/src/main/java/org/iotivity/service/sample/container/ResourceContainerActivity.java with 99% similarity]
service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/layout/group.xml [moved from service/resource-container/examples/android/ContainerSampleApp/app/src/main/res/layout/group.xml with 100% similarity]
service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/layout/list_item.xml [moved from service/resource-container/examples/android/ContainerSampleApp/app/src/main/res/layout/list_item.xml with 100% similarity]
service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/layout/resource_container.xml [moved from service/resource-container/examples/android/ContainerSampleApp/app/src/main/res/layout/resource_container.xml with 100% similarity]
service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/mipmap-hdpi/ic_launcher.png [new file with mode: 0755]
service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/mipmap-mdpi/ic_launcher.png [new file with mode: 0755]
service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png [new file with mode: 0755]
service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png [new file with mode: 0755]
service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/values-v21/styles.xml [new file with mode: 0755]
service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/values/strings.xml [moved from service/resource-container/examples/android/ContainerSampleApp/app/src/main/res/values/strings.xml with 100% similarity]
service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/values/styles.xml [moved from service/resource-container/examples/android/ContainerSampleApp/app/src/main/res/values/styles.xml with 100% similarity]
service/resource-container/examples/android/RCSampleServerApp/build.gradle [moved from service/resource-container/examples/android/ContainerSampleApp/build.gradle with 100% similarity]
service/resource-container/examples/android/RCSampleServerApp/gradlew [moved from service/resource-container/examples/android/ContainerSampleApp/gradlew with 100% similarity]
service/resource-container/examples/android/RCSampleServerApp/gradlew.bat [moved from service/resource-container/examples/android/ContainerSampleApp/gradlew.bat with 100% similarity]
service/resource-container/examples/android/RCSampleServerApp/settings.gradle [new file with mode: 0755]

diff --git a/service/resource-container/examples/android/ContainerSampleApp/RESampleServerApp.iml b/service/resource-container/examples/android/ContainerSampleApp/RESampleServerApp.iml
deleted file mode 100755 (executable)
index 2a02201..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
-  <component name="FacetManager">
-    <facet type="java-gradle" name="Java-Gradle">
-      <configuration>
-        <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
-      </configuration>
-    </facet>
-  </component>
-  <component name="NewModuleRootManager" inherit-compiler-output="false">
-    <output url="file://$MODULE_DIR$/build/classes/main" />
-    <output-test url="file://$MODULE_DIR$/build/classes/test" />
-    <exclude-output />
-    <content url="file://$MODULE_DIR$">
-      <excludeFolder url="file://$MODULE_DIR$/.gradle" />
-    </content>
-    <orderEntry type="inheritedJdk" />
-    <orderEntry type="sourceFolder" forTests="false" />
-  </component>
-</module>
-
diff --git a/service/resource-container/examples/android/RCSampleClientApp/app/app.iml b/service/resource-container/examples/android/RCSampleClientApp/app/app.iml
new file mode 100644 (file)
index 0000000..8501ed3
--- /dev/null
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
+  <component name="FacetManager">
+    <facet type="android-gradle" name="Android-Gradle">
+      <configuration>
+        <option name="GRADLE_PROJECT_PATH" value=":app" />
+      </configuration>
+    </facet>
+    <facet type="android" name="Android">
+      <configuration>
+        <option name="SELECTED_BUILD_VARIANT" value="debug" />
+        <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
+        <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
+        <option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
+        <option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
+        <option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
+        <option name="ALLOW_USER_CONFIGURATION" value="false" />
+        <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
+        <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
+        <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
+        <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
+      </configuration>
+    </facet>
+  </component>
+  <component name="NewModuleRootManager" inherit-compiler-output="false">
+    <output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/debug" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
+      <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
+      <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
+    </content>
+    <orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" exported="" name="iotivity-service-release-" level="project" />
+    <orderEntry type="library" exported="" name="iotivity-base-release-" level="project" />
+  </component>
+</module>
+
diff --git a/service/resource-container/examples/android/RCSampleClientApp/app/build.gradle b/service/resource-container/examples/android/RCSampleClientApp/app/build.gradle
new file mode 100644 (file)
index 0000000..a8285a4
--- /dev/null
@@ -0,0 +1,26 @@
+apply plugin: 'com.android.application'
+
+android {
+    compileSdkVersion 21
+    buildToolsVersion "21.1.2"
+
+    defaultConfig {
+        applicationId "org.iotivity.service.sample.client"
+        minSdkVersion 21
+        targetSdkVersion 21
+        versionCode 1
+        versionName "1.0"
+    }
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+    }
+}
+
+dependencies {
+    compile fileTree(include: ['*.jar'], dir: 'libs')
+    compile(name:'iotivity-service-release', ext:'aar')
+    compile(name:'iotivity-base-release', ext:'aar')
+}
diff --git a/service/resource-container/examples/android/RCSampleClientApp/app/src/main/AndroidManifest.xml b/service/resource-container/examples/android/RCSampleClientApp/app/src/main/AndroidManifest.xml
new file mode 100644 (file)
index 0000000..c42c1ca
--- /dev/null
@@ -0,0 +1,21 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="org.iotivity.service.sample.client">
+
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+
+    <application android:allowBackup="true" android:label="@string/app_name"
+        android:icon="@mipmap/ic_launcher" android:theme="@style/AppTheme">
+        <activity
+            android:name=".ContainerClientActivity"
+            android:label="@string/app_name" >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    <!--    <activity android:name=".ContainerClientActivity" /> -->
+    </application>
+
+</manifest>
diff --git a/service/resource-container/examples/android/RCSampleClientApp/app/src/main/java/org/iotivity/service/sample/client/ContainerClientActivity.java b/service/resource-container/examples/android/RCSampleClientApp/app/src/main/java/org/iotivity/service/sample/client/ContainerClientActivity.java
new file mode 100644 (file)
index 0000000..5ec437c
--- /dev/null
@@ -0,0 +1,75 @@
+/******************************************************************
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ * <p>
+ * <p>
+ * <p>
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.iotivity.service.sample.client;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.TextView;
+
+import org.iotivity.service.RcsException;
+import org.iotivity.service.client.RcsAddress;
+import org.iotivity.service.client.RcsDiscoveryManager;
+import org.iotivity.service.client.RcsRemoteResourceObject;
+
+/**
+ * It contains the discover resource API for Discovering Container Resource
+ */
+public class ContainerClientActivity extends Activity implements
+        RcsDiscoveryManager.OnResourceDiscoveredListener {
+    private final String LOG_TAG = "[SampleClient] "
+                                         + this.getClass().getSimpleName();
+
+    private TextView     mLogView;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_container_client);
+        mLogView = (TextView) findViewById(R.id.log);
+    }
+
+    public void onDiscoverResourceClick(View v) {
+        try {
+            RcsDiscoveryManager.getInstance().discoverResourceByType(
+                    RcsAddress.multicast(), "oic.r.discomfortindex",
+                    ContainerClientActivity.this);
+            mLogView.setText("");
+        } catch (RcsException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public void onResourceDiscovered(
+            final RcsRemoteResourceObject discoveredResource) {
+        Log.i(LOG_TAG, "onResourceDiscovered");
+
+        runOnUiThread(new Runnable() {
+            public void run() {
+                try {
+                    mLogView.setText(Utils.resourceInfo(discoveredResource));
+                } catch (RcsException e) {
+                    Utils.showError(ContainerClientActivity.this, LOG_TAG, e);
+                }
+            }
+        });
+    }
+}
diff --git a/service/resource-container/examples/android/RCSampleClientApp/app/src/main/java/org/iotivity/service/sample/client/Utils.java b/service/resource-container/examples/android/RCSampleClientApp/app/src/main/java/org/iotivity/service/sample/client/Utils.java
new file mode 100644 (file)
index 0000000..a39afd1
--- /dev/null
@@ -0,0 +1,39 @@
+package org.iotivity.service.sample.client;
+
+import android.content.Context;
+import android.util.Log;
+import android.widget.Toast;
+
+import org.iotivity.service.RcsException;
+import org.iotivity.service.client.RcsRemoteResourceObject;
+
+public class Utils {
+    public static String resourceInfo(RcsRemoteResourceObject resourceObject)
+            throws RcsException {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append("URI : " + resourceObject.getUri() + "\n");
+        sb.append("Host : " + resourceObject.getAddress() + "\n");
+        for (String type : resourceObject.getTypes()) {
+            sb.append("resourceType : " + type + "\n");
+        }
+
+        for (String itf : resourceObject.getInterfaces()) {
+            sb.append("resourceInterfaces : " + itf + "\n");
+        }
+
+        sb.append("isObservable : " + resourceObject.isObservable() + "\n");
+
+        return sb.toString();
+    }
+
+    public static void showError(Context ctx, String tag, String msg) {
+        Toast.makeText(ctx, msg, Toast.LENGTH_SHORT).show();
+        Log.e(tag, msg);
+    }
+
+    public static void showError(Context ctx, String tag, Exception e) {
+        Toast.makeText(ctx, e.getMessage(), Toast.LENGTH_SHORT).show();
+        Log.e(tag, e.getMessage(), e);
+    }
+}
diff --git a/service/resource-container/examples/android/RCSampleClientApp/app/src/main/res/layout/activity_container_client.xml b/service/resource-container/examples/android/RCSampleClientApp/app/src/main/res/layout/activity_container_client.xml
new file mode 100644 (file)
index 0000000..09634a3
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:id="@+id/main"
+    android:weightSum="1">
+
+    <Button
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:onClick="onDiscoverResourceClick"
+        android:text="@string/discover_resource"
+        android:id="@+id/di" />
+
+    <TextView
+        android:id="@+id/log"
+        android:layout_width="fill_parent"
+        android:layout_height="250dp"
+        android:ems="10"
+        android:layout_weight="0.26"
+        android:layout_below="@+id/di"
+        android:layout_alignParentStart="true" />
+
+</RelativeLayout>
diff --git a/service/resource-container/examples/android/RCSampleClientApp/app/src/main/res/values/strings.xml b/service/resource-container/examples/android/RCSampleClientApp/app/src/main/res/values/strings.xml
new file mode 100644 (file)
index 0000000..c5bd024
--- /dev/null
@@ -0,0 +1,5 @@
+<resources>
+    <string name="app_name">RCSampleClientApp</string>
+    <string name="container_resource">Discover Container Resource</string>
+    <string name="discover_resource">Discover Resource</string>
+</resources>
diff --git a/service/resource-container/examples/android/RCSampleClientApp/app/src/main/res/values/styles.xml b/service/resource-container/examples/android/RCSampleClientApp/app/src/main/res/values/styles.xml
new file mode 100644 (file)
index 0000000..ff6c9d2
--- /dev/null
@@ -0,0 +1,8 @@
+<resources>
+
+    <!-- Base application theme. -->
+    <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+        <!-- Customize your theme here. -->
+    </style>
+
+</resources>
diff --git a/service/resource-container/examples/android/RCSampleClientApp/build.gradle b/service/resource-container/examples/android/RCSampleClientApp/build.gradle
new file mode 100644 (file)
index 0000000..34a7ef9
--- /dev/null
@@ -0,0 +1,23 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+    repositories {
+        jcenter()
+    }
+    dependencies {
+        classpath 'com.android.tools.build:gradle:1.0.0'
+
+        // NOTE: Do not place your application dependencies here; they belong
+        // in the individual module build.gradle files
+    }
+}
+
+allprojects {
+    repositories {
+        jcenter()
+
+        flatDir {
+            dirs 'libs'
+        }
+    }
+}
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<module external.linked.project.id="ContainerSampleApp" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
+<module external.linked.project.id="RCSampleServerApp" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
   <component name="FacetManager">
     <facet type="java-gradle" name="Java-Gradle">
       <configuration>
@@ -16,4 +16,4 @@
     <orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
     <orderEntry type="sourceFolder" forTests="false" />
   </component>
-</module>
\ No newline at end of file
+</module>
diff --git a/service/resource-container/examples/android/RCSampleServerApp/README b/service/resource-container/examples/android/RCSampleServerApp/README
new file mode 100755 (executable)
index 0000000..5364aec
--- /dev/null
@@ -0,0 +1,23 @@
+To build the app 
+
+1. build Iotivity with TARGET_OS=android
+
+2. Copy aar files into app/libs folder
+   - {Iotivity_root}/android/android_api/base/build/outputs/aar/iotivity-{TARGET_ARCH}-base-{MODE}.aar
+   - {Iotivity_root}/service/resource-encapsulation/android/service/build/outputs/aar/iotivity-{TARGET_ARCH}-service-{MODE}.aar
+
+3. Configure dependencies for libs in app/build.gradle
+   - default TARGET_ARCH is armeabi
+   - default MODE is release
+
+   for example, if you build Iotivity as follows,
+   
+   $scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=0
+
+   then, dependencies should be modified like below
+
+   dependencies {
+      compile(name:'iotivity-x86-service-debug', ext:'aar')
+      compile(name:'iotivity-x86-base-debug', ext:'aar')
+   }
+   
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="ContainerSampleApp" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
+<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="RCSampleServerApp" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
   <component name="FacetManager">
     <facet type="android-gradle" name="Android-Gradle">
       <configuration>
@@ -93,4 +93,4 @@
     <orderEntry type="library" exported="" name="iotivity-armeabi-v7a-resource-container-release-" level="project" />
     <orderEntry type="library" exported="" name="iotivity-base-armeabi-v7a-release-" level="project" />
   </component>
-</module>
\ No newline at end of file
+</module>
@@ -63,7 +63,7 @@ public class ResourceContainerActivity extends Activity {
     // private static final String LOG_TAG =
     // ResourceContainerActivity.class.getSimpleName();
 
-    private final String                     LOG_TAG = "[ContainerSampleApp] "
+    private final String                     LOG_TAG = "[RCSampleServerApp] "
             + this.getClass()
             .getSimpleName();
     private static ResourceContainerActivity resourceContainerActivityInstance;
diff --git a/service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/mipmap-hdpi/ic_launcher.png b/service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100755 (executable)
index 0000000..cde69bc
Binary files /dev/null and b/service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/mipmap-mdpi/ic_launcher.png b/service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100755 (executable)
index 0000000..c133a0c
Binary files /dev/null and b/service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100755 (executable)
index 0000000..bfa42f0
Binary files /dev/null and b/service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100755 (executable)
index 0000000..324e72c
Binary files /dev/null and b/service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/values-v21/styles.xml b/service/resource-container/examples/android/RCSampleServerApp/app/src/main/res/values-v21/styles.xml
new file mode 100755 (executable)
index 0000000..dba3c41
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <style name="AppTheme" parent="android:Theme.Material.Light">
+    </style>
+</resources>
diff --git a/service/resource-container/examples/android/RCSampleServerApp/settings.gradle b/service/resource-container/examples/android/RCSampleServerApp/settings.gradle
new file mode 100755 (executable)
index 0000000..e7b4def
--- /dev/null
@@ -0,0 +1 @@
+include ':app'