Versions Compared

Key

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

Follow the instructions below to configure WSO2 EMM for Android:

Table of Contents
maxLevel3
minLevel3
 

Step 1 - Register with Google Cloud Messaging

Follow the instructions below to register with Google Cloud Messaging (GCM):

...

On the Dashboard page, click Projects and thereafter click Create Project to create a new project for our application.
After creating the project, you will see the Project Number in the created project. That project number will be our sender ID when you communicate with the GCM server; therefore, you need to copy that and keep it safely.

...

Click APIs & auth and then click APIs

...

Turn on “Google cloud messaging for Android".

...

Click APIs & auth and then click Credentials.

...

Step 2 - Configure and build the Android client application

Follow the instructions below to configure and build the Android client application:

  1. Get a GIT clone of the Android Agent application from GitHub.
  2. Install the Android plugin for Eclipse. For more information, see Installing the Eclipse Plugin.
  3. Open the project in your Eclipse IDE.
  4. Click Import and select Existing project to workspace wizard to import the project.
  5. Click Import and select Existing Android Code to workspace, to import the ActionBarSherlock project from the <MDMAgent Project folder><ANDROID_EMM_AGENT>/Plugins/ActionBarSherlock/library/ directory, to the same workspace.  
  6. Check whether the library is linked to the MDMAgent <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.
  7. Clean and build ActionBarSherlock library project. Anchorstep7step7Use

  8. 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

    to create a BKS file

    , which

    that is compatible with Android.

    Rename

    Rename the BKS file

    to

    to emm_truststore.bks

      and
    Info

     and add it inside your Android project’s res/raw/ directory, replacing the sample provided.


    Code Block
    /** * Helper class providing methods and constants common to other classes in the * app. */ public class CommonUtilities { public static boolean DEBUG_MODE_ENABLED = true;

    The BKS file password needs to be generated only for testing purposes.

    Go to the java class named CommonUtilities.java in the com.wso2mdm.mdm.utils package and replace the SERVER_URL and TRUSTSTORE_PASSWORD (Password used to generate the BKS file in step 7)  as seen below:

    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_IPAPP_ENDPOINT = "----ADD YOUR HOSTNAME HERE----/emm/api/";
    
    	public static String OAUTH_ENDPOINT =   "/oauth2/token";
    	public static String SERVERSENDER_ID_PORTENDPOINT = "9443devices/sender_id/";
    	public static String IS_REGISTERED_ENDPOINT =    "devices/isregistered/";
    	public static String SERVERLICENSE_PROTOCOLENDPOINT = "https:devices/license/";
    	public static String REGISTER_ENDPOINT =    "devices/register/";
    	public static String SERVER_APPUNREGISTER_ENDPOINT = "devices/mdmunregister/api/";
    	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 = "----ADD YOUR TRUST STORE PASSWORD HERE----";
    
    
            	public static final String getSERVEREULA_URL()TITLE {= "POLICY AGREEMENT";
  9. Clean and build the project.
  10. 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.

    Note

    When exporting the APK, you can leave the application unsigned or you can opt to sign the application with a valid key. Unsigned applications cannot be installed on a non-rooted Android phone. Therefore, in a production environment it is recommended to sign the the Android application with a valid key. For more information, see Signing Your Applications from Eclipse with ADT.

    Info

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

  11. 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": {
            return SERVER_URL;"android_location": "%http.ip%/emm/client_app/emm-agent-android.apk",
            }"ios": {
              public static void setSERVER_URL(String sERVER_URL) {"location": "%http.ip%/emm/client_app/emm-agent-ios.ipa",
                "bundleid": "com.wso2.emm.agent",
         SERVER_IP = sERVER_URL;     "version": "1.1",
              SERVER_URL = "https://"+sERVER_URL+appname":"+SERVER_PORT+"/mdm/api/"; "EMM Agent"
            }
        }
  12. Clean and build the project.
  13. Name the project emm
    ,
    and export the project as an Android application. You will get an .apk file.
Info

You have to carryout the Android server configurations after completing the Android client configurations.

...