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.


...
buildscript {
repositories {
...
ย  ย  maven { url 'https://repo.onestore.net/repository/onestore-sdk-public' }
}
}
...

Next, add the ONE store ALC library dependency to the appโ€™s build.gradle file.


...
dependencies {
def onestore_sdk_version = "2.0.0"
implementation "com.onestorecorp.sdk:sdk-licensing:$onestore_sdk_version"
}
...

Add queries to AndroidManifest.xml

Please refer to the ONE store Developer Center notices for setting up the following two cases:

For Android 11 or higher (Target SDK 30 or higher), you must add queries.


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dev.sample">
<queries>
<intent>
<action android:name="com.onestore.extern.licensing.LicensingService.ACTION" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="onestore" />
</intent>
</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.


...
buildscript {
repositories {
...
ย  ย  maven { url 'https://repo.onestore.net/repository/onestore-sdk-public' }
}
}
...

Next, add the ONE store configuration library dependency to the app's build.gradle file.


...
dependencies {
def onestore_configuration_version = "1.0.0"
implementation "com.onestorecorp.sdk:sdk-configuration-kr:$onestore_configuration_version"
}
...

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.

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
...
val appLicenseChecker = AppLicenseChecker.get(this@MainActivity, getString(R.string.public_key, new AppLicenseListener())
}

...
inner class AppLicenseListener : LicenseCheckerListener {
override fun granted(license: String, signature: String) {}

override fun denied() {}

override fun error(code: Int, message: String) {}
}

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.

class AppLicenseListener : LicenseCheckerListener {
override fun granted(license: String, signature: String) {
// License check successful
}

override fun denied() {
// Rejeck license check
}

override fun error(code: Int, message: String) {
// License check error
}
}

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.

appLicenseChecker.queryLicense()

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.

appLicenseChecker.strictQueryLicense()

Disconnecting

Call the destroy function in AppLicenseChecker to disconnect from the ONE store service.

override fun onDestroy() {
if (null != appLicenseChecker) {
appLicenseChecker.destroy()
}

super.onDestory()
}

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