Android SDK Integration Guide

Learn how to integrate the SaleSmartly Android SDK for seamless user communication and data handling.

1. Android SDK Integration Guide

Note: Android version >= 7.0 Webview component version >= 53

1.1. App Manifest Required Permissions

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

1.2. AAR Package Address

Portal

1.3. SDK Initialization Methods

1.3.1. Initialize SDK

SaleSmartyInit.init(Context context,String scriptUrl);

Note: scriptUrl is the inserted js, such as https://assets.salesmartly.com/js/project_xxxxx.js

1.3.2. Initialize the SaleSmarty Webpage

SaleSmartyInit.initSaleSmartyView(Activity activity);

Note: Initialize the browser as early as possible in the Activity

1.3.3. Add the Browser to Parent Layout

SaleSmartyInit.addSaleSmartyView(ViewGroup viewGroup);

Note: The Activity where the added parent layout is located must be consistent with the Activity that executes the initialization of the salesmarty web page

1.3.4. Upload User Information

SaleSmartyInit.uploadUserMessage(String user_id,
                               String user_name,
                               String language,
                               String phone,
                               String email,
                               String description,
                               String[] label_names);

Note: Uploading user information does not support callbacks at the moment, user_id and user_name are required

1.3.5. Open the Window

SaleSmartyInit.openSaleSmartyView();

1.3.6. Close the Window

SaleSmartyInit.closeSaleSmartyView();

1.3.7. Get Unread Message Count

SaleSmartyInit.setUnReadMessagesListener(c var0);

Note: The parameter c interface will return an int value, which is the number of unread messages.

1.3.8. File Selection Callback

SaleSmartyInit.upLoadFiles(int requestCode,Intent var0);

Note: Should be called in the onActivityResult of the Activity that initializes the salesmarty web page

1.3.9. Loading Completion Listener (v1.2.0+)

SaleSmartyInit.setOnReadyListener(c var0);

1.3.10. Window Open Listener

SaleSmartyInit.setOnOpenSaleSmartyViewListener(c var0);
// Version 1.2.0 performs open operation by default

1.3.11. Window Close Listener

SaleSmartyInit.setOnCloseSaleSmartyViewListener(c var0);

1.4. Demo Example

SaleSmartly Android SDK Demo example, click to download