IOT-2795 Android context for PlatformConfig 37/22737/2
authorGeorge Nash <george.nash@intel.com>
Mon, 9 Oct 2017 18:40:31 +0000 (11:40 -0700)
committerRick Bell <richard.s.bell@intel.com>
Mon, 9 Oct 2017 21:19:57 +0000 (21:19 +0000)
PlatformConfig on android should set context and activity
when the PlatformConfig was added to support introspection
the context and activity were missed due to developing and
testing using generic java code.

Bug: https://jira.iotivity.org/browse/IOT-2795
Bug: https://jira.iotivity.org/browse/IOT-2773
Change-Id: I208bde482977d88d750a2628691be81683f261bd
Signed-off-by: George Nash <george.nash@intel.com>
java/iotivity-android/src/main/java/org/iotivity/base/PlatformConfig.java

index 26c4a43..434df67 100644 (file)
@@ -42,6 +42,8 @@ public class PlatformConfig {
     private int mTransportType;
 
     /**
+     * @param activity           app activity
+     * @param context            app context
      * @param serviceType        indicate IN_PROC or OUT_OF_PROC
      * @param modeType           indicate whether we want to do server, client or both
      * @param ipAddress          ip address of server
@@ -54,7 +56,8 @@ public class PlatformConfig {
      * @param dbPath             Persistant storage file for SVR Database.
      * @param introspectionPath  Persistant storage file for introspection data.
      */
-    public PlatformConfig(
+    public PlatformConfig(Activity activity,
+                          Context context,
                           ServiceType serviceType,
                           ModeType modeType,
                           String ipAddress,
@@ -62,6 +65,8 @@ public class PlatformConfig {
                           QualityOfService qualityOfService,
                           String dbPath,
                           String introspectionPath) {
+        this.mActivity=activity;
+        this.mContext = context;
         this.mServiceType = serviceType;
         this.mModeType = modeType;
         this.mIpAddress = ipAddress;