# V2 AppLicenseChecker

```
public abstract class AppLicenseChecker extends Object
java.lang.Object
```

&#x20;   ↳ com.onestore.extern.licensing.AppLicenseChecker

<br>

ALC 라이브러리와 사용자 앱 코드 간의 통신을 위한 기본 인터페이스 입니다.

```
class YourActivity extends AppCompatActivity {
     private AppLicensChecker mAppLicenseChecker;       
	
	 @Override
	 protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		...
		mAppLicenseChecker = AppLicenseChecker.get(MainActivity.this, getString(R.string.public_key, new AppLicenseListener());
	}
...
}

private class AppLicenseListener implements LicenseCheckerListener {
	...
}
```

AppLicenseChecker.get()을 통해 publicKey와 응답결과를 전달받는 LicenseCheckerListener를 설정합니다.

<br>

### Summary <a href="#v2applicensechecker-summary" id="v2applicensechecker-summary"></a>

***

| Nested classes |              |
| -------------- | ------------ |
| @interface     | ResponseCode |

### Public methods <a href="#v2applicensechecker-publicmethods" id="v2applicensechecker-publicmethods"></a>

***

### get <a href="#v2applicensechecker-get" id="v2applicensechecker-get"></a>

```
public static AppLicenseChecker get(Context context, String base64PublicKey, LicenseCheckerListener listener)
```

<br>

AppLicenseChecker의 인스턴스를 생성합니다.

| Parameters:       |                                              |
| ----------------- | -------------------------------------------- |
| context           | applicationContext를 통해 로그인 모듈과 연결을 위해 사용됩니다. |
| base64PublicKey   | base64PublicKey                              |
| listener          | LicenseCheckerListener                       |
| Returns:          |                                              |
| AppLicenseChecker |                                              |

### queryLicense <a href="#v2applicensechecker-querylicense" id="v2applicensechecker-querylicense"></a>

```
@AnyThread
public abstract void queryLicense()
```

<br>

queryLicense API를 호출시 캐시 정책을 동반하여 동작하게 됩니다.\
일반적으로 원스토어 서버를 통해 사용자의 구매 이력 라이선스를 전달 받지만, 원스토어 서버에 접근 할 수 없는 경우 로컬에 캐시된 라이선스 정보를 이용하여 유효기간까지 실행을 보장해 주는 방식입니다.\
네트워크 상황의 문제나, 비행기 모드를 이용하는 사용자를 위해 해당 API 사용을 권장합니다.

### strictQueryLicense <a href="#v2applicensechecker-strictquerylicense" id="v2applicensechecker-strictquerylicense"></a>

```
@AnyThread
public abstract void strictQueryLicense()

strictQueryLicense API를 호출시 캐시된 라이선스 정보를 사용하지 않습니다. 이 경우 원스토어 서버에 접근할 수 없는 상황에서 사용자가 앱을 이용할 수 없습니다.
```

### destroy <a href="#v2applicensechecker-destroy" id="v2applicensechecker-destroy"></a>

```
@AnyThread
public abstract void destroy()

원스토어 서비스와의 연결을 해제합니다.
```

```



```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://onestore-dev.gitbook.io/dev/tools/alc/alc-v2-reference/annotation/v2-applicensechecker.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
