This is the 10th day of my participation in the August More Text Challenge. For details, see:August is more challenging
background
Because the project needs to integrate a work order system, and the project is in the overseas market, for various reasons, some domestic manufacturers can not use the work order system, so I chose Zendesk
To prepare
First in the website for account registration after successful registration, in the site Settings page to create the project
Enter the application name on the page that appearsChoose one of the authentication methods, anonymous if there are no requirements for identity, or anonymous if there are strict requirements for identity. RightJWT
, you need background support
integration
The SDK documentation
PS: The minimum Zendesk SDK support is API level 21. The Zendesk SDK Java runtime environment is 8
- Setting the Java version
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Copy the code
- Set required permissions
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Copy the code
- Add the Zendesk Maven repository to the project root directory
repositories {
maven {
url "https://zendesk.jfrog.io/artifactory/repo"}}Copy the code
- Add the dependent
implementation (group: 'com.zendesk', name: 'support', version: '5.0.2') {exclude group: 'com.squareup'
}
Copy the code
use
private static final String SUBDOMAIN_URL = "Your Zendesk URL";
private static final String APPLICATION_ID = "Your App ID";
private static final String OAUTH_CLIENT_ID = "Your Client ID";
Copy the code
- in
Application
Or you need to callzendesk
Initialize the SDK in advance
Zendesk.INSTANCE.init(this, SUBDOMAIN_URL, APPLICATION_ID, OAUTH_CLIENT_ID);
Copy the code
- In the start
Zendesk
You need to set your identity in advance
Zendesk.INSTANCE.setIdentity(
new AnonymousIdentity.Builder()
.withNameIdentifier("Your Name")
.withEmailIdentifier("Your Email")
.build()
);
Copy the code
- Initialize the
Support
Support.INSTANCE.init(Zendesk.INSTANCE);
Copy the code
- If you want to jump directly to the work order system
RequestActivity.builder().withRequestSubject("Add title").withTags("Add Tag").show(this);
Copy the code
- If you need to see the worksheet, then jump from the worksheet to the worksheet system
Configuration requestActivityConfig = RequestActivity.builder()
.withTags("MyVitalsPro_v" + BuildConfig.VERSION_NAME, AppInfoUtils.PHONE_NAME + "_" + AppInfoUtils.RELEASE_VERSION)
.config();
RequestListActivity.builder()
.show(requireContext(), requestActivityConfig);
Copy the code
Zs_activity_request_list_scene_empty (); zs_activity_request_LIST_SCENe_empty ()