# Quick Start
# Integration
We highly recommend you integrate AIHelp SDK with Gradle:
dependencies {
implementation 'net.aihelp:android-aihelp-aar:3.4.+'
}
The third-party-library used by AIHelp are as follows: androidx.recyclerView
, okhttp3
, okio
.
If you're only integrating AIHelp AAR file, please make sure you've got all these libraries in your dependency.
# API
WARNING
Please ensure you are doing the initialization job at the very beginning of your application's lifecycle, otherwise there maybe unintended runtime exception.
# init()
You can do the AIHelp initialization job by calling this method:
if (USER_FROM_MAINLAND_CHINA) {
AIHelpSupport.additionalSupportFor(PublishCountryOrRegion.CN);
}
AIHelpSupport.init(this,
"THIS IS YOUR APP KEY",
"THIS IS YOUR APP DOMAIN",
"THIS IS YOUR APP ID",
"THIS IS YOUR DEFAULT LANGUAGE(OPTIONAL)");
AIHelp provides additional domain support for specific country or region, check here to learn more.
# setOnAIHelpInitializedCallback()
We also provide apis for you to monitor SDK's initialization status:
public class App extends Application implements OnAIHelpInitializedCallback {
@Override
public void onCreate() {
super.onCreate();
AIHelpSupport.setOnAIHelpInitializedCallback(this);
}
@Override
public void onAIHelpInitialized() {
// when init job is done, you can get callback here.
}
}
# Definition
# context
- Type:
Context
- Details: Required. The context for current session, activity or application object for most cases.
# appKey / domain / appId
- Type:
String
- Details: Required. You can get these parameters at here:
# language
- Type:
String
- Default:
device's locale language
- Details: Optional. This is AIHelp's default initialize language; If you are not setting this, we will use device's locale language to initialize AIHelp SDK.
- See also: Check here to learn language code you may need. Going International?
# onAIHelpInitializedCallback
- Type:
OnAIHelpInitializedCallback
- Default:
null
- Details: Optional. AIHelp's initialization callback, you'll get notified when the init job is done.
# Code Example
Please ensure you are initializing AIHelp in onCreate()
method of your Application or MainActivity.
The code examples are as follows:
// init SDK in Application.java(recommended)
public class App extends Application implements OnAIHelpInitializedCallback {
@Override
public void onCreate() {
super.onCreate();
if (USER_FROM_MAINLAND_CHINA) {
AIHelpSupport.additionalSupportFor(PublishCountryOrRegion.CN);
}
AIHelpSupport.init(this,
"THIS IS YOUR APP KEY",
"THIS IS YOUR APP DOMAIN",
"THIS IS YOUR APP ID",
"THIS IS YOUR DEFAULT LANGUAGE(OPTIONAL)");
AIHelpSupport.setOnAIHelpInitializedCallback(this);
}
@Override
public void onAIHelpInitialized() {
// when init job is done, you can get callback here.
}
}
// init SDK in MainActivity.java
public class MainActivity extends Activity implements OnAIHelpInitializedCallback {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (USER_FROM_MAINLAND_CHINA) {
AIHelpSupport.additionalSupportFor(PublishCountryOrRegion.CN);
}
AIHelpSupport.init(this,
"THIS IS YOUR APP KEY",
"THIS IS YOUR APP DOMAIN",
"THIS IS YOUR APP ID",
"THIS IS YOUR DEFAULT LANGUAGE(OPTIONAL)");
AIHelpSupport.setOnAIHelpInitializedCallback(this);
}
@Override
public void onAIHelpInitialized() {
// when init job is done, you can get callback here.
}
}