Android SDK
# Android Integration Description
Sobot provides the enterprises with a full set of perfect intelligent agent solutions. Sobot ticket SDK provides support for all tickets and allows enterprises to complete a series of ticket operations with the accounts they used.
Sobot ticket SDK has the following features:
- Provide a complete process of login - use - logout.
- Consist of two login modules: external login with synchronized token and regular login with username and password.
- Support basic functions such as ticket query, operation, and creation.
Related limits and notes:
Android SDK supports Android above 4.2 (API 17) and supports both portrait mode and landscape mode.
Android Studio should be upgraded to versions above 3.0.
Android SDK requires storage and photo permissions; otherwise, some functions are not available.
# File Introduction
# ● Schematic Diagram of Integration Process
# ● File Description
SDK files include source package (sobotordersdk), Demo source code (Sobot_Order_Sdk_Demo_Android), and Doc related documentation.
File | Description |
---|---|
SobotOrderApi | The file provides an access function |
# Integration Method
# ● Dependency Integration
Latest version address](https://central.sonatype.com/artifact/com.sobot.zcsdk/ordersdk)
api 'com.sobot.zcsdk:ordersdk:+'
In build.gradle:
dependencies {
api 'com.squareup.okhttp3:okhttp:4.4.0'
api 'androidx.appcompat:appcompat:1.0.0'
api 'com.google.android.material:material:1.4.+'
api 'androidx.recyclerview:recyclerview:1.0.0'
//implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
//implementation 'com.squareup.picasso:picasso:2.71828'
//implementation 'com.facebook.fresco:fresco:2.6.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
}
2
3
4
5
6
7
8
9
10
[Note]
If you want to use your own image loading method, you can use the following methods: SobotBitmapUtil. setImageLoader (new SobotImageLoader() {}); After using this method, the image loading method within the SDK will no longer be used when displaying network images.
# ● Import Integration
Download link:Android_Order_SDK (opens new window)
Import Module
Unzip the downloaded Wisdom Teeth Android_Order_SDK_XXX.zip file, import the sobotorsdk module directly into your project, then Build -->clean the project, and add project dependencies in build.gradle
After completing the above steps, the build. gradle is as follows:
dependencies {
api project(":sobotordersdk")
api 'com.squareup.okhttp3:okhttp:4.4.0'
api 'androidx.appcompat:appcompat:1.0.0'
api 'com.google.android.material:material:1.4.+'
api 'androidx.recyclerview:recyclerview:1.0.0'
//Currently, several common image loading libraries are supported, and one must be selected from the image loading libraries below to add a dependency
//implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
//implementation 'com.squareup.picasso:picasso:2.71828'
//implementation 'com.facebook.fresco:fresco:2.6.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
}
2
3
4
5
6
7
8
9
10
11
12
[Note]
If you want to use your own image loading method, you can use the following methods: SobotBitmapUtil. setImageLoader (new SobotImageLoader() {}); After using this method, the image loading method within the SDK will no longer be used when displaying network images.
# Function Description
# ● Domain Name and Initialization Settings
Domain name description:
- If you use localized deployment, please use your deployed server domain name.
[Note: Before initiating Sobot ticket SDK, call the initialization API initWithHost; otherwise, the SDK cannot be initiated.]
/**
* Initialization method, which shall be called before initiating Sobot page
*
* @param host can be null. The default param is Alibaba Cloud server. You can set your own domain name if you need
*/
SobotOrderApi.initWithHost(Application application, String host);
2
3
4
5
6
# ● Initiate Sobot Page
# 1. Initiate Ticket Homepage
Method 1: Directly use the method we provide to automatically complete the login and redirect to the page.
Three startup methods:
/**
* Start the work order system through email password and enter the homepage
* @param context
* @param loginUser Customer service account
* @param loginPwd Login password
* @param block The callback result can be empty
*/
SobotOrderApi.startWithAcount(Context context, String loginUser, String loginPwd, SobotResultBlock block);
/**
* Start the work order system by setting the company token and enter the homepage
* @param context
* @param loginUser Customer service account
* @param companyToken Company token
* @param block The callback result can be empty
*/
SobotOrderApi.startWithWithCompanyToken(Context context, String loginUser, String companyToken, SobotResultBlock block);
/**
* Start the work order system through account+appKey+appId
*
* @param context
* @param loginUser Customer service account
* @param appKey Log in to appKey and ask for after-sales colleagues to obtain it (this will be available when the customer account is opened)
* @param appId Log in to the appId and ask the after-sales colleague to obtain it (this will appear when the customer account is opened)
* @param block The callback result can be empty
*/
SobotOrderApi.startWithAppkey(Context context, String loginUser, String appKey, String appId, SobotResultBlock block);
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Method 2: Manually log in and jump to the page by embedding fragment. You need to log in first and then perform jump operation.
Step 1: Log in
// Login method 1
/**
* Log in to ticket system with email password
* @param context
* @param loginPwd Agent email
* @param loginPwd Login password
* @param isGoToActivity Whether to enter the Ticket Center interface true: YES false: NO, just log in
* @param block Callback result, which can be null
*/
SobotOrderApi.loginUser(Context context, String loginUser, String loginPwd,false, SobotResultBlock block);
// Login method 2
/**
* Log in to ticket system by setting token
* @param context
* @param loginToken Agent login token
* @param isGoToActivity Whether to enter the Ticket Center interface true: YES false: NO, just log in
* @param block Callback result, which can be null
*/
SobotOrderApi.loginUser(Context context, String loginToken, false, SobotResultBlock block)
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Step 2: Enter Fragment
Reference code
SobotWOclassificationFragment classificationFragment;
classificationFragment = (SobotWOclassificationFragment) getSupportFragmentManager()
.findFragmentById(getResId("order_fragment"));
if (classificationFragment == null) {
classificationFragment = SobotWOclassificationFragment.newInstance();
addFragmentToActivity(getSupportFragmentManager(), classificationFragment, getResId("order_fragment"));
}
2
3
4
5
6
7
# 2. Initiate Ticket Details
[Note: Before performing the operation, you need to ensure that you have logged in.]
The method is as follows:
/**
* Enter ticket details page
*
* @param context
* @param orderId Ticket ID
* @param block Callback result, which can be null
*/
SobotOrderApi.openOrderDetail(Context context, String orderId, SobotResultBlock block);
2
3
4
5
6
7
8
# 3. Initiate the Create Ticket Page
[Note: Before performing the operation, you need to ensure that you have logged in.]
The method is as follows:
/**
* Initiate the ticket creation page
*
* @param context
* @param param can be null, and userName (user's nickname) or userId (user ID) can be added
* @param block Callback result
*/
SobotOrderApi.openCreateWorkOrder(final Context context, Map<String, Object> param, SobotResultBlock block)
2
3
4
5
6
7
8
Sample code
Map<String, Object> param = new HashMap<>();
if (TextUtils.isEmpty(userid.getText().toString())){
if(!TextUtils.isEmpty(nick.getText().toString())){
SobotToastUtil.showCustomToast(getSobotActivity(), "If you enter a nickname, but the user id is blank, the corresponding customer is also blank and invalid");
}else{
if(SobotStringUtils.isEmpty(nick.getText().toString())){
SobotToastUtil.showCustomToast(getContext(),"User nickname cannot be blank");
return;
}
param.put("userName", nick.getText().toString());
param.put("userId", userid.getText().toString());
}
}
SobotOrderApi.openCreateWorkOrder(getSobotActivity(), param, null);
2
3
4
5
6
7
8
9
10
11
12
13
14
# ● Login
// Login method 1
/**
* Log in to ticket system with email password
* @param context
* @param loginPwd Agent email
* @param loginPwd Login password
* @param isGoToActivity Whether to enter the Ticket Center interface true: YES false: NO, just log in
* @param block Callback result, which can be null
*/
SobotOrderApi.loginUser(Context context, String loginUser, String loginPwd,false, SobotResultBlock block);
// Login method 2
/**
* Log in to ticket system by setting token
* @param context
* @param loginToken Agent login token
* @param isGoToActivity Whether to enter the Ticket Center interface true: YES false: NO, just log in
* @param block Callback result, which can be null
*/
SobotOrderApi.loginUser(Context context, String loginToken, false, SobotResultBlock block)
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# ● Logout
/**
* Exit ticket system
* @param context
* @param loginUser Login account
* @param block Callback result, which can be null
*/
SobotOrderApi.out(Context context, String loginUser, SobotResultBlock block)
2
3
4
5
6
7
# ● Set Debug Mode and Enable Logs
/**
* Log display setting
*
* @param isShowLog true Display log information false (not display) by default
*/
SobotOrderApi.setShowDebug(Boolean isShowLog)
2
3
4
5
6
# ● Customize UI Settings
# 1. Replace UI Pattern with Namesake Resources
You can add the namesake color to colors.xml in the customer app to cover the color style in the Sobot SDK; replace the images in the Sobot SDK interface by placing a namesake image resource at the same location in the main project; replace the text in the Sobot SDK interface by placing a namesake text resource at the same location in the main project.
The following are common color configurations. More color and image resources can be found in the Download Source Package in the manual integration module.
<!--Ticket Theme color Green by default -->
<color name="sobot_wo_theme_color">#09AEB0</color>
<!-- Header background -->
<color name="sobot_color_title_bar_bg">@color/sobot_wo_theme_color</color>
<!-- Status bar color setting -->
<color name="sobot_status_bar_color">@color/sobot_color_title_bar_bg</color>
<!-- Header middle nickname color -->
<color name="sobot_color_title_bar_title">@color/sobot_wo_white_color</color>
<!-- Header both-side menu font color -->
<color name="sobot_color_title_bar_menu_text">@color/sobot_wo_white_color</color>
<!-- Level-1 text Color -->
<color name="sobot_wo_wenzi_gray1">#3D4966</color>
<!-- Level-2 text Color -->
<color name="sobot_wo_wenzi_gray2">#8B98AD</color>
<!-- Level-3 text Color -->
<color name="sobot_wo_wenzi_gray3">#BDC3D1</color>
<!-- Level-4 text Color -->
<color name="sobot_wo_wenzi_gray4">#CCCCCC</color>
<!--Interface General background color -->
<color name="sobot_wo_bg_color">#EFF3FA</color>
<!-- Level-2 background color -->
<color name="sobot_wo_second_bg_color">#FFFFFF</color>s
<!-- Page background Level-3 color -->
<color name="sobot_wo_third_bg_color">#EFF3FA</color>
<!-- Transparent background color-->
<color name="sobot_wo_app_bg_transparent">@color/sobot_wo_transparent</color>
<!-- Background color of search box-->
<color name="sobot_wo_search_bg_color">#F6F8FC</color>
<!-- Hyperlink color-->
<color name="sobot_wo_link">@color/sobot_wo_blue_color</color>
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Source Code and Demo
Download the Demo source code (opens new window)
Download the installation package (opens new window)
# FAQ
1.Get token ?
Please get the login token through the Sobot login API. In case of failure, you can log in with your username and password. The two methods have exactly the same effect.
Why can't I log in normally?
Before login, please confirm whether to perform the initialization operation, which is a local assignment; there will be no asynchronous requests, and the domain name and basic configuration information will be set. After confirming that the login information is correct, mainly verify whether the domain name fails to match.How to embed the ticket homepage into other frameworks?
Please refer to the Demo project, which has examples of using tabbar to put the Ticket Center page into it for management.How to monitor ticket reminder?
Message reminder is not currently available. You can give feedback to the relevant docking staff if you need, and we will notify you in time when it is added.
# Description of Sobot SDK's Collection and Use of Personal Information
Description of Sobot SDK's Collection and Use of Personal Information (opens new window)