Add ALC library dependency
Add ALC library dependency
Register the ONE store maven address in the project top-level build.gradle file.
For the Android Studio (version: bumblebee), add from settings.gradle.
Next, add the ONE store ALC library dependency to the app’s build.gradle file.
Add queries to AndroidManifest.xml
Please refer to the ONE store notices for setting up the following two cases:
For Android 11 or higher (Target SDK 30 or higher), you must add queries.
Add configuration for ONE store login
Register the ONE store maven address in the project top-level build.gradle file.
It is the same as the pre-operation when adding ALC library dependencies.
Next, add the ONE store configuration library dependency to the app's build.gradle file.
Initialize AppLicenseChecker
To request a user's purchase license using the Application License Checker, you must create an instance of AppLicenseChecker.
You must pass the license key issued by the Developer Center for license verification. As the results of whether you have a valid license are delivered through LicenseCheckerListener, you must also create a Listener at initialization.
Saving the license key
For license keys, it is recommended to use it after receiving it through a server rather than saving it as an in-app code to ensure security.
Callback registration
When initializing AppLicenseChecker, LicenseCheckerListener must be registered.
LicenseCheckeerListener is an interface for processing the results of license verifications. License verification results always call one of the LicenseCheckeerListener methods.
There are three methods: granted(), denied(), and error(), and simple result processing behavior can be used. The error() method forwards error codes and messages. For error codes, please refer to the response codes below.
Request license verification
When calling the license check, the license is delivered through communication with the ONE store server. When users are unable to access the ONE store server normally due to network failures or airplane mode, etc., a cache policy is generally used to ensure the app runs during the validity period of the cached license. If you do not want to use the cache policy, you can use it without using a license cached through the strictQueryLicense API.
Calling QueryLicense API (Cached API)
Works in conjunction with the cache policy. Generally, a user's purchase history license is delivered through the ONE store server, but when access to the ONE store server is not possible due to network failures or airplane mode, a locally cached license is used to ensure execution until the expiration date.
Calling StrictQueryLicense API (Non-Cached API)
Cached licenses are not to be used. If the API is used during network failure or in airplane mode, the user cannot use the app because access to the ONE store server is not possible.
Disconnecting
Call the destroy function in AppLicenseChecker to disconnect from the ONE store service.
Response Codes
The table below shows the response codes and messages for errors delivered from the ONE store ALC library to the application. Applications that use the library must process the response codes.
Response Code | Value | Description(KR) | Description(EN) | How to handle Solutions |
---|---|---|---|---|
RESULT_OK | 0 | 성공 | Success |
|
ERROR_CLIENT_NOT_ENABLED | 1010 | 원스토어에 연결할 수 없습니다. 원스토어 앱 실행이 필요합니다. | Unable to connect to ONE store. Please start the ONE store app. |
|
ERROR_SERVICE_UNAVAILABLE | 2000 | 서비스를 이용할 수 없는 상태입니다. | Service unavailable. | Please contact ONE store. |
ERROR_DATA_PARSING | 2001 | 파라메터가 유효하지 않습니다. | Invalid parameter. | Please contact ONE store. |
ERROR_SIGNATURE_VERIFICATION | 2002 | 라이선스 키가 맞지 않거나 구매 내역이 없는 유저 입니다. | The license key does not match, or the user has no purchase history. | Please check the license key at the ONE store Developer Center. |
ERROR_SERVICE_TIMEOUT | 2100 | 서비스 응답이 없습니다. | No response from server. | Please check the network status. |
ERROR_USER_LOGIN_CANCELD | 2101 | 사용자가 로그인을 취소하였습니다. | Login canceled by the user. | Please login to ONE store. |
ERROR_INSTALL_USER_CANCELED | 2103 | 원스토어 서비스 설치를 취소하였습니다. | ONE store service installation has been canceled. Install ONE store? | Please install ONE store. |
ERROR_NOT_FOREGROUND | 2104 | 백그라운드 서비스에서는 진행할 수 없습니다. | Cannot proceed within the background service |
|
RESULT_UNKNOWN | -1 | 알 수 없는 오류가 발생하였습니다. | An unknown error has occurred. | Please contact ONE store. |
RESULT_USER_CANCELED | 1 | 사용자가 로그인을 취소하였습니다. | Login canceled by the user. | Please login to ONE store. |
RESULT_SERVICE_UNAVAILABLE | 2 | 단말 또는 서버 네트워크 오류가 발생하였습니다. | An error has occurred in your device or server network. | Please check your network status. |
RESULT_ALC_UNAVAILABLE | 3 | ALC api 버전 정보가 낮습니다. 해당 라이브러리를 업데이트 해주세요. | An updated ALC api version is required. Please update the library. | Please update the ALC library to the latest version. |
RESULT_DEVELOPER_ERROR | 5 | 파라메터가 유효하지 않습니다. | Invalid parameter. | Please contact ONE store. |
RESULT_ERROR | 6 | 정의되지 않은 기타 오류가 발생하였습니다. | An unknown error has occurred. | Please contact ONE store. |
Last updated