fixed operations flow

revert-dabc3590
inosh-perera 10 years ago
parent 3b4742046b
commit 4a26b86460

@ -527,7 +527,7 @@ int string application_package_prefix 0x7f0b0099
int string button_cancel 0x7f0b0095 int string button_cancel 0x7f0b0095
int string button_ok 0x7f0b0094 int string button_ok 0x7f0b0094
int string client_id 0x7f0b000f int string client_id 0x7f0b000f
int string client_secreat 0x7f0b0010 int string client_secret 0x7f0b0010
int string device_admin_disabled 0x7f0b0030 int string device_admin_disabled 0x7f0b0030
int string device_admin_enable_alert 0x7f0b003f int string device_admin_enable_alert 0x7f0b003f
int string device_admin_enabled 0x7f0b002f int string device_admin_enabled 0x7f0b002f

@ -2,7 +2,7 @@
<resources> <resources>
<string name="client_id">NsOFFVXkUsahefJHDC4S2csarPka</string> <string name="client_id">NsOFFVXkUsahefJHDC4S2csarPka</string>
<string name="client_secreat">EnG1MjQxF5tiFE0DDNvfJ_6ou_8a</string> <string name="client_secret">EnG1MjQxF5tiFE0DDNvfJ_6ou_8a</string>
<string name="error_config">Please set the %1$s constant and recompile the app.</string> <string name="error_config">Please set the %1$s constant and recompile the app.</string>
<string name="already_registered">Device is already registered on server.</string> <string name="already_registered">Device is already registered on server.</string>

@ -150,6 +150,7 @@ public class AlreadyRegisteredActivity extends SherlockActivity implements APIRe
btnUnregister = (Button) findViewById(R.id.btnUnreg); btnUnregister = (Button) findViewById(R.id.btnUnreg);
btnUnregister.setTag(TAG_BTN_UNREGISTER); btnUnregister.setTag(TAG_BTN_UNREGISTER);
btnUnregister.setOnClickListener(onClickListenerButtonClicked); btnUnregister.setOnClickListener(onClickListenerButtonClicked);
LocalNotification.startPolling(context);
} }

@ -228,7 +228,7 @@ public class AuthenticationActivity extends SherlockActivity implements APIAcces
// Check network connection availability before calling the API. // Check network connection availability before calling the API.
if (PhoneState.isNetworkAvailable(context)) { if (PhoneState.isNetworkAvailable(context)) {
initializeIDPLib(getResources().getString(R.string.client_id), initializeIDPLib(getResources().getString(R.string.client_id),
getResources().getString(R.string.client_secreat)); getResources().getString(R.string.client_secret));
} else { } else {
CommonDialogUtils.stopProgressDialog(progressDialog); CommonDialogUtils.stopProgressDialog(progressDialog);
CommonDialogUtils.showNetworkUnavailableMessage(context); CommonDialogUtils.showNetworkUnavailableMessage(context);

@ -101,10 +101,10 @@ public class RegistrationActivity extends Activity implements APIResultCallBack
propertiesArray.put(property); propertiesArray.put(property);
property= new JSONObject(); property= new JSONObject();
property.put("name", "imei"); property.put("name", "imei");
property.put("value", deviceInfo.getIMSINumber()); property.put("value", deviceInfo.getDeviceId());
propertiesArray.put(property); propertiesArray.put(property);
property= new JSONObject(); property= new JSONObject();
property.put("name", "imei"); property.put("name", "imsi");
property.put("value", deviceInfo.getIMSINumber()); property.put("value", deviceInfo.getIMSINumber());
propertiesArray.put(property); propertiesArray.put(property);
property= new JSONObject(); property= new JSONObject();
@ -116,10 +116,6 @@ public class RegistrationActivity extends Activity implements APIResultCallBack
property.put("value", deviceInfo.getOsVersion()); property.put("value", deviceInfo.getOsVersion());
propertiesArray.put(property); propertiesArray.put(property);
property= new JSONObject(); property= new JSONObject();
property.put("name", "vendor");
property.put("value", deviceInfo.getDeviceManufacturer());
propertiesArray.put(property);
property= new JSONObject();
property.put("name", "osVersion"); property.put("name", "osVersion");
property.put("value", deviceInfo.getOsVersion()); property.put("value", deviceInfo.getOsVersion());
propertiesArray.put(property); propertiesArray.put(property);

@ -112,6 +112,8 @@ public class ServerApiAccess {
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
e.printStackTrace(); e.printStackTrace();
} }
}else{
httpPost.setEntity(null);
} }
Log.e("url",""+url); Log.e("url",""+url);
HttpPost httpPostWithHeaders = (HttpPost)buildHeaders(httpPost,headers,httpMethod); HttpPost httpPostWithHeaders = (HttpPost)buildHeaders(httpPost,headers,httpMethod);
@ -138,7 +140,7 @@ public class ServerApiAccess {
// } // }
HttpGet httpGet = new HttpGet(url); HttpGet httpGet = new HttpGet(url);
HttpGet httpGetWithHeaders = (HttpGet) buildHeaders(httpGet,headers,httpMethod); HttpGet httpGetWithHeaders = (HttpGet) buildHeaders(httpGet,headers,httpMethod);
Log.d(TAG,httpGetWithHeaders.toString()); Log.d(TAG,httpGetWithHeaders.toString()+" GET");
try { try {
HttpResponse response = httpclient.execute(httpGetWithHeaders); HttpResponse response = httpclient.execute(httpGetWithHeaders);
responseParams.put("response", getResponseBody(response)); responseParams.put("response", getResponseBody(response));

@ -32,10 +32,10 @@ public class AlarmReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Log.d(DEBUG_TAG, "Recurring alarm; requesting download service."); Log.d(DEBUG_TAG, "Recurring alarm; requesting download service.");
String mode=CommonUtilities.getPref(context, context.getResources().getString(R.string.shared_pref_message_mode)); String mode=CommonUtilities.getPref(context, context.getResources().getString(R.string.shared_pref_message_mode));
if(mode.trim().toUpperCase().equals(Constant.LOCAL)){ //if(mode.trim().toUpperCase().equals(Constant.LOCAL)){
MessageProcessor messageProcessor=new MessageProcessor(context); MessageProcessor messageProcessor=new MessageProcessor(context);
messageProcessor.getMessages(); messageProcessor.getMessages();
} //}
} }
} }

@ -26,12 +26,15 @@ import android.os.SystemClock;
* polls to server based on a predefined to retrieve pending data. * polls to server based on a predefined to retrieve pending data.
*/ */
public class LocalNotification { public class LocalNotification {
public static boolean localNoticicationInvoked=false;
public static void startPolling(Context context) { public static void startPolling(Context context) {
int interval=10000; int interval=10000;
long firstTime = SystemClock.elapsedRealtime(); long firstTime = SystemClock.elapsedRealtime();
firstTime += 1000; firstTime += 1000;
if(localNoticicationInvoked==false){
localNoticicationInvoked=true;
Intent downloader = new Intent(context, AlarmReceiver.class); Intent downloader = new Intent(context, AlarmReceiver.class);
PendingIntent recurringDownload = PendingIntent.getBroadcast(context, PendingIntent recurringDownload = PendingIntent.getBroadcast(context,
0, downloader, PendingIntent.FLAG_CANCEL_CURRENT); 0, downloader, PendingIntent.FLAG_CANCEL_CURRENT);
@ -41,3 +44,4 @@ public class LocalNotification {
interval, recurringDownload); interval, recurringDownload);
} }
} }
}

@ -16,10 +16,14 @@
package org.wso2.cdm.agent.services; package org.wso2.cdm.agent.services;
import java.io.File; import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Map; import java.util.Map;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject;
import org.wso2.cdm.agent.R;
import org.wso2.cdm.agent.RegistrationActivity; import org.wso2.cdm.agent.RegistrationActivity;
import org.wso2.cdm.agent.api.DeviceInfo; import org.wso2.cdm.agent.api.DeviceInfo;
import org.wso2.cdm.agent.proxy.APIResultCallBack; import org.wso2.cdm.agent.proxy.APIResultCallBack;
@ -82,11 +86,20 @@ public class MessageProcessor implements APIResultCallBack {
* pending. * pending.
*/ */
public void getMessages() { public void getMessages() {
String ipSaved =
ServerUtils.callSecuredAPI(context, CommonUtilities.SERVER_URL + CommonUtilities.NOTIFICATION_ENDPOINT+File.separator+deviceId, Preference.get(context.getApplicationContext(),
CommonUtilities.POST_METHOD, null, MessageProcessor.this, context.getResources().getString(R.string.shared_pref_ip));
CommonUtilities.setServerURL(ipSaved);
String deviceIdentifier = "";
try {
deviceIdentifier = URLEncoder.encode(deviceId, "utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
ServerUtils.callSecuredAPI(context, CommonUtilities.API_SERVER_URL +
CommonUtilities.NOTIFICATION_ENDPOINT+File.separator+deviceIdentifier,
CommonUtilities.GET_METHOD, new JSONObject(), MessageProcessor.this,
CommonUtilities.NOTIFICATION_REQUEST_CODE); CommonUtilities.NOTIFICATION_REQUEST_CODE);
Log.e("sadfs",CommonUtilities.SERVER_URL + CommonUtilities.NOTIFICATION_ENDPOINT);
} }
@Override @Override

@ -47,7 +47,7 @@ public class CommonUtilities {
public static String SENDER_ID_ENDPOINT = "devices/sender_id/"; public static String SENDER_ID_ENDPOINT = "devices/sender_id/";
public static String IS_REGISTERED_ENDPOINT = "devices/isregistered/"; public static String IS_REGISTERED_ENDPOINT = "devices/isregistered/";
public static String UNREGISTER_ENDPOINT = "devices/unregister/"; public static String UNREGISTER_ENDPOINT = "devices/unregister/";
public static String NOTIFICATION_ENDPOINT = "/operations/"+API_VERSION; public static String NOTIFICATION_ENDPOINT = "/operation/"+API_VERSION;
public static String SERVER_URL = SERVER_PROTOCOL + SERVER_IP + ":" public static String SERVER_URL = SERVER_PROTOCOL + SERVER_IP + ":"
+ SERVER_PORT ; + SERVER_PORT ;
@ -142,7 +142,7 @@ public class CommonUtilities {
public static final String OPERATION_DEVICE_INFO = "500A"; public static final String OPERATION_DEVICE_INFO = "500A";
public static final String OPERATION_DEVICE_LOCATION = "501A"; public static final String OPERATION_DEVICE_LOCATION = "501A";
public static final String OPERATION_GET_APPLICATION_LIST = "502A"; public static final String OPERATION_GET_APPLICATION_LIST = "502A";
public static final String OPERATION_LOCK_DEVICE = "503A"; public static final String OPERATION_LOCK_DEVICE = "DEVICE_LOCK";
public static final String OPERATION_WIPE_DATA = "504A";//reset device public static final String OPERATION_WIPE_DATA = "504A";//reset device
public static final String OPERATION_CLEAR_PASSWORD = "505A"; public static final String OPERATION_CLEAR_PASSWORD = "505A";
public static final String OPERATION_NOTIFICATION = "506A"; public static final String OPERATION_NOTIFICATION = "506A";

@ -1,5 +1,5 @@
# cache for current jar dependency. DO NOT EDIT. # cache for current jar dependency. DO NOT EDIT.
# format is <lastModified> <length> <SHA-1> <path> # format is <lastModified> <length> <SHA-1> <path>
# Encoding is UTF-8 # Encoding is UTF-8
1417676912000 484258 bd6479f5dd592790607e0504e66e0f31c2b4d308 /home/inoshp/Documents/work/EMM 2.0/Source/CDM/product-cdm/product/modules/agents/android/client/libs/android-support-v4.jar 1421927786000 484258 bd6479f5dd592790607e0504e66e0f31c2b4d308 /home/inoshp/Documents/work/EMM 2.0/Source/CDM/product-mdm/product/modules/mobileservices/agents/android/client/libs/android-support-v4.jar
1417676912000 484258 bd6479f5dd592790607e0504e66e0f31c2b4d308 /home/inoshp/Documents/work/EMM 2.0/Source/CDM/product-cdm/product/modules/agents/android/client/plugins/ActionBarSherlock/library/libs/android-support-v4.jar 1421927786000 484258 bd6479f5dd592790607e0504e66e0f31c2b4d308 /home/inoshp/Documents/work/EMM 2.0/Source/CDM/product-mdm/product/modules/mobileservices/agents/android/client/plugins/ActionBarSherlock/library/libs/android-support-v4.jar

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

@ -28,7 +28,6 @@ import org.wso2.cdm.agent.proxy.IdentityProxy;
import org.wso2.cdm.agent.services.AlarmReceiver; import org.wso2.cdm.agent.services.AlarmReceiver;
import org.wso2.cdm.agent.utils.CommonDialogUtils; import org.wso2.cdm.agent.utils.CommonDialogUtils;
import org.wso2.cdm.agent.utils.CommonUtilities; import org.wso2.cdm.agent.utils.CommonUtilities;
import org.wso2.cdm.agent.utils.Constant;
import org.wso2.cdm.agent.utils.HTTPConnectorUtils; import org.wso2.cdm.agent.utils.HTTPConnectorUtils;
import org.wso2.cdm.agent.utils.Preference; import org.wso2.cdm.agent.utils.Preference;
import org.wso2.cdm.agent.utils.ServerUtils; import org.wso2.cdm.agent.utils.ServerUtils;

Loading…
Cancel
Save