Android

Mluvii provides a framework for integration with your application(Android 5.0+, lower version are not supported due to the low version of WebView). The code provided by us enables you to:

  • initiate a webview with a widget with your company data

MluviiLibrary.getMluviiWebView(Context, server_name, company_id, tenant_id, widget_name, language);
  • notification on change of widget status

 MluviiLibrary.setStatusOnlineCallback(() ->{});
 MluviiLibrary.setStatusBusyCallback(() ->{});
 MluviiLibrary.setStatusOfflineCallback(() ->{});
  • open chat

 MluviiLibrary.runChat();
  • close the chat and load a page with widget

MluviiLibrary.setCloseChatFunc(() ->{});
  • add own handling for opening URL in chat

MluviiLibrary.setUrlCallbackFunc(new MluviiLibrary.UrlCallback(){

            @Override
            public Void call() throws Exception{
                Log.d("MLUVII_URL_CALLBACK","Test url: "+this.url);
                return null;
            }
        });
  • adding customized parameters - when adding customized parameters, you must first set them in the Administration Interface, see Application

  • if the user of your mobile application has to perform some action (click on a button, etc.) after opening the WebView, we recomment to add a delay e.g. 2 seconds. This will ensure flawless saving of values to existing session parameters.

  • it is necessary to first set parameters and then call MluviiLibrary.runChat()

MluviiLibrary.addCustomData("'param_name'", "'param_value'");
  • To allow tracking of clients(chat history) you need to allow cookies in webView

if (android.os.Build.VERSION.SDK_INT >= 21) {   
  CookieManager.getInstance().setAcceptThirdPartyCookies(mluviiWebView, true);
} else {
  CookieManager.getInstance().setAcceptCookie(true);
} 

If you want to use a video, you need to enable your camera and microphone in your application.

You need to allow permissions in manifest

    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.CAMERA" />

In Android 6.0+ you have to add in app check for permissions. This can be called when needed and code should look like this:

if (ContextCompat.checkSelfPermission(this,
                Manifest.permission.CAMERA)
                != PackageManager.PERMISSION_GRANTED) {

            if (ActivityCompat.shouldShowRequestPermissionRationale(this,
                    Manifest.permission.CAMERA)) {
                //Can add explanation why do you need this specific permissions
                ActivityCompat.requestPermissions(this,
                        new String[]{Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO},
                        REQUEST_CAMERA_PERMISSION);

            } else {
                // No explanation needed; request the permission
                ActivityCompat.requestPermissions(this,
                        new String[]{Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO},
                        REQUEST_CAMERA_PERMISSION);
            }
        }

Android Library

Sample Code

You can find it here.

Last updated