# Quick Start
# Integration
Download (opens new window) the AIHelp .unitypackage
file on GitHub, import it to your project.
AIHelp Unity SDK is an encapsulation for Android and iOS with bridge files to the native code.
# Android
Android is using Gradle under the hood, you can find the dependency code in the mainTemplate.gradle
:
dependencies {
implementation 'net.aihelp:android-aihelp-aar:5.3.+'
}
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.
# iOS
iOS is using .framework
library under the hood.
Add
Privacy - Photo Library Usage Description
declaration to your info.plist.Add
-ObjC
to the Other Linker Flags field in your Build Settings in Xcode.
# 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 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.
# RegisterAsyncEventListener()
We also provide API for you to register SDK's events, including initialize status:
AIHelpSupport.RegisterAsyncEventListener(
AIHelp.EventType.Initialization,
(jsonEventData, ack) => {
// When init job is done, you can get callback here
// `jsonData`: { "isSuccess": true, "message": "Success" }
}
);
# 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:
public class StartBehaviourScript : MonoBehaviour
{
private void Awake()
{
if (USER_FROM_MAINLAND_CHINA) {
AIHelpSupport.AdditionalSupportFor(PublishCountryOrRegion.CN);
}
AIHelpSupport.Initialize(
"THIS IS YOUR APP DOMAIN",
"THIS IS YOUR APP ID",
"THIS IS YOUR DEFAULT LANGUAGE(OPTIONAL)"
);
AIHelpSupport.RegisterAsyncEventListener(
AIHelp.EventType.Initialization,
(jsonData, ack) => {
// When init job is done, you can get callback here
// `jsonData`: { "isSuccess": true, "message": "Success" }
}
);
}
}
Events →