This example client side application demonstrates how to integrate client side library with server side library.

Download button

Configuring the client side library

Important. Your client side library will work only with server side library.

  1. Download the Mobile Connect client side library

    git clone
  2. Open project in Android Studio.
  3. Download and install any missing dependencies or plugins from the links displayed in the console output.
  4. Build the project.

Open the configuration file: /local-path/Application/src/main/res/values/configuration.xml.
Here are two parameters:

<string name="server_endpoint">your server side endpoint</string>
<string name="msisdn">default msisdn</string>

Be sure to provide your server side endpoint (endpoint of your server side library).
You can also configure your msisdn, if it's necessary.
Add your custom configuration (e.g. ip_address).

Using the client side library

With your configuration specified in the configuration file or using user interface, you have everything you need to make a successful call to the server side library.
You can use client side application in three modes:

  • Using msisdn
  • Using MCC_MNC
  • None mode

Also you can add IP address to the request to server side.
After you clicking "Mobile Connect" button the Application does the following:

  1. Checks which mode you have selected.
  2. Checks that configuration of your selected mode is valid.
  3. Makes sendDiscoveryRequest method call with your configuration in parameters:
    private void sendDiscoveryRequest(String msisdn, String mcc, String mnc, String ipAddress) {
            List<NameValuePair> params = HttpUtils.prepareParameters(msisdn, mcc, mnc, ipAddress);
            final String requestUrl = HttpUtils.createGetWithParams(getString(R.string.server_endpoint), params);
            MobileConnectView mobileConnectView = new MobileConnectView();
            mobileConnectView.startAuthentication(getContext(), requestUrl);

    This method generates GET request to the server side endpoint (from your configuration). To generate the request parameters it uses prepareParameters method:
    private List<NameValuePair> prepareParameters(String msisdn, String mcc, String mnc, String ipAddress) {
            List<NameValuePair> params = new LinkedList<>();
            if (!StringUtils.isNullOrEmpty(msisdn)) {
                params.add(new BasicNameValuePair(Constants.MSISDN, msisdn));
            } else if (!StringUtils.isNullOrEmpty(mcc) && !StringUtils.isNullOrEmpty(mnc)) {
                params.add(new BasicNameValuePair(Constants.MCC, mcc));
                params.add(new BasicNameValuePair(Constants.MNC, mnc));
            if (!StringUtils.isNullOrEmpty(ipAddress)) {
                params.add(new BasicNameValuePair(Constants.SOURCE_IP, ipAddress));
            return params;

    After having prepared a request URI the application sends GET request by passing the request URL into the WebView:
    MobileConnectView mobileConnectView = new MobileConnectView();
            mobileConnectView.startAuthentication(getContext(), requestUrl);
    • If you are using only msisdn the request to your server side part will be: http://server_side_endpoint?msisdn=your_msisdn.
    • When you are using mcc and mnc it will be: http://server_side_endpoint?mcc=your_mcc&mnc=your_mnc.
    • If you choose 'None' mode: http://server_side_endpoint?.
    • Also you can check 'IP address' e.g. in msisdn mode: http://server_side_endpoint?msisdn=your+msisdn&ip_address=your_ip_address.
  4. In case of failure while sending the request to server side, the result is displaying in the WebView.

  5. After displaying web view:
    • In msisdn mode you will see a few redirects until the web view gets the URL with 'code' and 'state' parameters.
    • Using MCC_MNC or none mode you will be redirected to the operator selection page. Here you can type your msisdn and process page.

    In any case after getting URL with 'code' and 'state' parameters application sends GET request (to the server side) by opening this URL and gets the response with JSON, that contains the results information. After getting the response the application closes the WebView and shows 'Dialog Closed' message. AuthenticationWebViewClient watches URL's in web view dialog using shouldOverrideUrlLoading method:

        public boolean shouldOverrideUrlLoading(final WebView view, final String url) {
            super.shouldOverrideUrlLoading(view, url);
            Log.i(TAG, String.format("Loading URL=%s", url));
            if (url.contains(Constants.CODE_PARAM) && url.contains(Constants.STATE_PARAM)) {
                Toast.makeText(view.getContext(), view.getContext().getString(R.string.dialog_closed), Toast.LENGTH_SHORT).show();
                return true;
            } else {
                return false;