Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Get a GIT clone of the Android Agent application from GitHub.
  2. Open the project in your Eclipse IDE.
  3. Click Import and select Existing project to workspace wizard to import the project.
  4. Click Import and select Existing Android Code to workspace, to import the ActionBarSherlock project from the <ANDROID_EMM_AGENT>/Plugins/ActionBarSherlock/library/ directory, to the same workspace.  
  5. Check whether the library is linked to the <ANDROID_EMM_AGENT> project as follows:
    • Click project properties and select Android.
    • At the bottom of the interface that appears, you will see the Library section. Verify that the ActionBarSherlock project is correctly referenced. 
    • If it is incorrectly referenced, remove the existing reference and add it again using the ActionBarSherlock library that you imported into workspace.
  6. Clean and build ActionBarSherlock library project.

  7. By default, the Android agent communicates with the server through http. For production, this needs to be changed to https, by configuring the following parameters in the Java class named CommonUtilities.java, which is in the org.wso2.emm.agent.utils package: SERVER_IP, SERVER_PORT and SERVER_PROTOCOL.

    Info

    If the SSL certificate is self signed, use the CA certificate PEM file that is generated for iOS to create a BKS file that is compatible with Android. Rename the BKS file to emm_truststore.bks and add it inside your Android project’s res/raw/ directory, replacing the sample provided. The BKS file password needs to be added as the value for the TRUSTSTORE_PASSWORD parameter.

    Code Block
    	public static boolean DEBUG_MODE_ENABLED = false;
    	public static boolean LOCAL_NOTIFICATIONS_ENABLED = true;
    	public static boolean GCM_ENABLED = false;
    
    	public static String SERVER_IP = "";
    
    	public static String SERVER_PORT = "9763";
    	public static String SERVER_PROTOCOL = "http://";
    	public static String API_VERSION = "1.0.0";
    	
    	public static String SERVER_APP_ENDPOINT = "/emm/api/";
    
    	public static String OAUTH_ENDPOINT = "/oauth2/token";
    	public static String SENDER_ID_ENDPOINT = "devices/sender_id/";
    	public static String IS_REGISTERED_ENDPOINT = "devices/isregistered/";
    	public static String LICENSE_ENDPOINT = "devices/license/";
    	public static String REGISTER_ENDPOINT = "devices/register/";
    	public static String UNREGISTER_ENDPOINT = "devices/unregister/";
    	public static String NOTIFICATION_ENDPOINT = "notifications/pendingOperations/";
    	
    	public static String SERVER_URL = SERVER_PROTOCOL + SERVER_IP + ":"
    			+ SERVER_PORT + SERVER_APP_ENDPOINT;
    
    	public static final String TRUSTSTORE_PASSWORD = "";
    	public static final String EULA_TITLE = "POLICY AGREEMENT";
  8. Clean and build the project.
  9. Export the project as an Android application. A .apk file will be generated. This file needs to be added to the <EMM_HOME>/repository/deployment/server/jaggeryapps/emm/client_apps/ directory.

    Info

    There is a sample application named emm-agent-android.apk in the <EMM_HOME>/repository/deployment/server/jaggeryapps/emm/client_apps/ directory.

  10. Add the path of the .apk file as the Android location in the config.json file, which is in the <EMM_HOME>/repository/deployment/server/jaggeryapps/emm/config/ directory.

    Code Block
    	},
        "device": {
            "android_location": "%http.ip%/emm/client_app/emm-agent-android.apk",
            "ios": {
                "location": "%http.ip%/emm/client_app/emm-agent-ios.ipa",
                "bundleid": "com.wso2.mobileemm.agent",
                "version": "IOS_IPAVERSION1.1",
                "appname": "EMM Agent"
            }
        },