---
title: "Integration with Java native application"
description: "Initialize and use the integration library from a Java-based Android application."
canonical: "https://docs.cm.com/payments/pos-terminal-sdk/guides/java-integration"
---

# Integration with Java native application

> Initialize and use the integration library from a Java-based Android application.

Source: https://docs.cm.com/payments/pos-terminal-sdk/guides/java-integration

Our library is written in Kotlin, but it is fully compatible with an Android Java application. The integration with a Java application is the same as with a Kotlin written application.

Once the library is included as dependency in the gradle file, the library needs to be initialized with the context of the application.

**Code Sample. initialize library in Java application**

```kotlin
@Override 
 public void onCreate() {
     super.onCreate();
     AndroidPosIntegration.INSTANCE.init(this); 
     ...
}
```

In the previous example, in the onCreate method of the class that is extending the Android Application class, the `AndroidPosIntegration.init()` method is called from the Java code. The `INSTANCE` part is needed as compatibility between Java and Kotlin library.

Once the application has been initialized, an instance of the PosIntegrationService can be got using the following code:

**Code Sample. get PosIntegrationService instance from CM POS Payments AndroidPosIntegrationLibrary**

```kotlin
PosIntegrationService paymentService = AndroidPosIntegration.INSTANCE.getInstance();
```
