diff --git a/AppLaunchClientAndroid/applaunch-client-android/build.gradle b/AppLaunchClientAndroid/applaunch-client-android/build.gradle index e0eebdd..c354471 100644 --- a/AppLaunchClientAndroid/applaunch-client-android/build.gradle +++ b/AppLaunchClientAndroid/applaunch-client-android/build.gradle @@ -36,6 +36,7 @@ dependencies { }) compile 'com.google.code.gson:gson:2.8.0' compile 'com.ibm.mobilefirstplatform.clientsdk.android:core:[2.0.0,3.0.0)' + // compile 'com.ibm.mobilefirstplatform.clientsdk.android:core: 3.1.+' compile 'com.squareup.picasso:picasso:+' compile 'com.android.support:appcompat-v7:25.3.1' testCompile 'junit:junit:4.12' diff --git a/AppLaunchClientAndroid/applaunch-client-android/src/main/java/com/ibm/mobile/applaunch/android/api/AppLaunch.java b/AppLaunchClientAndroid/applaunch-client-android/src/main/java/com/ibm/mobile/applaunch/android/api/AppLaunch.java index 2b33538..d604603 100644 --- a/AppLaunchClientAndroid/applaunch-client-android/src/main/java/com/ibm/mobile/applaunch/android/api/AppLaunch.java +++ b/AppLaunchClientAndroid/applaunch-client-android/src/main/java/com/ibm/mobile/applaunch/android/api/AppLaunch.java @@ -506,9 +506,10 @@ private void register(final AppLaunchListener appLaunchListener, Hashtable param Enumeration keys = parameters.keys(); while(keys.hasMoreElements()){ String key = (String) keys.nextElement(); - initJson.put(key,parameters.get(key)); + // initJson.put(key,parameters.get(key)); paramsJson.put(key,parameters.get(key)); } + initJson.put("attributes",paramsJson); appLaunchCacheManager.addString(appLaunchConfig.getUserID()+"-"+appLaunchConfig.getBluemixRegion()+"-"+appLaunchConfig.getApplicationId()+"-params",paramsJson.toString()); } //construct registration url @@ -708,13 +709,15 @@ private void sendPostRequest(final String methodName, String url, JSONObject bod Map> headers = new HashMap<>(); List headerValues = new ArrayList<>(); headerValues.add("application/json"); - headers.put("Content-Type", headerValues); + // headerValues.add("application/json; charset = UTF-8"); + headers.put("content-type", headerValues); List secretValues = new ArrayList<>(); secretValues.add(appLaunchConfig.getClientSecret()); headers.put("clientSecret", secretValues); // headers.put("clientSecret",appLaunchConfig.getClientSecret()); postReq.setHeaders(headers); + postReq.send(appContext, body.toString(), new ResponseListener() { @Override public void onSuccess(Response response) { diff --git a/AppLaunchClientAndroid/applaunch-client-android/src/main/java/com/ibm/mobile/applaunch/android/api/ICRegion.java b/AppLaunchClientAndroid/applaunch-client-android/src/main/java/com/ibm/mobile/applaunch/android/api/ICRegion.java index 022d92e..549f616 100644 --- a/AppLaunchClientAndroid/applaunch-client-android/src/main/java/com/ibm/mobile/applaunch/android/api/ICRegion.java +++ b/AppLaunchClientAndroid/applaunch-client-android/src/main/java/com/ibm/mobile/applaunch/android/api/ICRegion.java @@ -7,23 +7,24 @@ public enum ICRegion { - US_SOUTH(".us-south.containers.mybluemix.net"), + US_SOUTH(".ng.bluemix.net"), - UNITED_KINGDOM(".eu-gb.containers.mybluemix.net"), + UNITED_KINGDOM(".eu-gb.bluemix.net"), - SYDNEY(".sydney.containers.mybluemix.net"), + SYDNEY(".au-syd.bluemix.net"), - US_SOUTH_STAGING("-staging.us-south.containers.mybluemix.net"), + US_SOUTH_STAGING(".stage1.ng.bluemix.net"), - UNITED_KINGDOM_STAGING("-staging.eu-gb.containers.mybluemix.net"), + UNITED_KINGDOM_STAGING(".stage1.eu-gb.bluemix.net"), - SYDNEY_STAGING("-staging.sydney.containers.mybluemix.net"), + SYDNEY_STAGING(".stage1.au-syd.mybluemix.net"), - US_SOUTH_DEV("-dev.us-south.containers.mybluemix.net"), + US_SOUTH_DEV(".dev.ng.mybluemix.net"), - UNITED_KINGDOM_DEV("-dev.eu-gb.containers.mybluemix.net"), + UNITED_KINGDOM_DEV(".dev.eu-gb.bluemix.net"), + + SYDNEY_DEV(".dev.au-syd.bluemix.net"); - SYDNEY_DEV("-dev.sydney.containers.mybluemix.net"); private String region; diff --git a/AppLaunchClientAndroid/applaunch-client-android/src/main/java/com/ibm/mobile/applaunch/android/common/AppLaunchUtils.java b/AppLaunchClientAndroid/applaunch-client-android/src/main/java/com/ibm/mobile/applaunch/android/common/AppLaunchUtils.java index 5f5ad8d..73b1d37 100644 --- a/AppLaunchClientAndroid/applaunch-client-android/src/main/java/com/ibm/mobile/applaunch/android/common/AppLaunchUtils.java +++ b/AppLaunchClientAndroid/applaunch-client-android/src/main/java/com/ibm/mobile/applaunch/android/common/AppLaunchUtils.java @@ -78,13 +78,13 @@ private static String getPlatform() { public static JSONObject getInitJson(Application application) { JSONObject initObject = new JSONObject(); try { - initObject.put("model", getModel()); - initObject.put("brand", getBrand()); - initObject.put("OSVersion", getOSVersion()); + // initObject.put("model", getModel()); + // initObject.put("brand", getBrand()); + // initObject.put("OSVersion", getOSVersion()); initObject.put("platform", getPlatform()); - initObject.put("appId", getPackageName(application)); - initObject.put("appVersion", "1.0.0"); - initObject.put("appName", getAppName(application)); + // initObject.put("appId", getPackageName(application)); + // initObject.put("appVersion", "1.0.0"); + // initObject.put("appName", getAppName(application)); } catch (JSONException e) { initObject = null; logger.error("Error creating init json " + e.getMessage()); diff --git a/AppLaunchClientAndroid/applaunch-client-android/src/main/java/com/ibm/mobile/applaunch/android/internal/AppLaunchUrlBuilder.java b/AppLaunchClientAndroid/applaunch-client-android/src/main/java/com/ibm/mobile/applaunch/android/internal/AppLaunchUrlBuilder.java index b229ff2..51dee42 100644 --- a/AppLaunchClientAndroid/applaunch-client-android/src/main/java/com/ibm/mobile/applaunch/android/internal/AppLaunchUrlBuilder.java +++ b/AppLaunchClientAndroid/applaunch-client-android/src/main/java/com/ibm/mobile/applaunch/android/internal/AppLaunchUrlBuilder.java @@ -21,10 +21,15 @@ public class AppLaunchUrlBuilder { private static String USERS = "/users"; private static String MOBILESERVICES = "https://applaunch"; private static String APPLAUNCH_CONTEXT = "/applaunch/v1"; - + private static String MOBILESERVICES_DEV="https://mobileservices-dev.us-south.containers.mybluemix.net"; + public AppLaunchUrlBuilder(ICRegion region, String appID, String deviceID,String userId) { - this.baseURL = MOBILESERVICES + region.toString() + APPLAUNCH_CONTEXT; + if(region.equals(ICRegion.US_SOUTH_DEV)){ + this.baseURL = MOBILESERVICES_DEV+APPLAUNCH_CONTEXT; + }else{ + this.baseURL = MOBILESERVICES + region.toString() + APPLAUNCH_CONTEXT; + } this.applicationID = appID; this.deviceID = deviceID; this.userId = userId; diff --git a/AppLaunchClientAndroid/applaunchsample/build.gradle b/AppLaunchClientAndroid/applaunchsample/build.gradle index 7c65787..36c58da 100644 --- a/AppLaunchClientAndroid/applaunchsample/build.gradle +++ b/AppLaunchClientAndroid/applaunchsample/build.gradle @@ -31,6 +31,7 @@ dependencies { compile 'com.android.support:appcompat-v7:25.3.+' compile 'com.android.support:support-v4:25.3.1' compile 'com.ibm.mobilefirstplatform.clientsdk.android:core:[2.0.0,3.0.0)' + // compile 'com.ibm.mobilefirstplatform.clientsdk.android:core: 3.1.4' compile 'com.squareup.picasso:picasso:+' compile project (':applaunch-client-android') testCompile 'junit:junit:4.12' diff --git a/README.md b/README.md index 29f463a..b31a55f 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ To use the Bluemix App Launch SDK include the following: ``` dependencies { ........ - compile 'com.github.ibm-bluemix-mobile-services:bms-clientsdk-android-applaunch:0.0.1' + compile 'com.github.ibm-bluemix-mobile-services:bms-clientsdk-android-applaunch:0.0.5' compile 'com.ibm.mobilefirstplatform.clientsdk.android:core:[2.0.0,3.0.0)' ....... }