> For the complete documentation index, see [llms.txt](https://docs.funzy.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.funzy.vn/android-fid-sdk/2.-sdk-integration.md).

# 2. SDK Integration

## Calling functions in activity lifecycle

{% tabs %}
{% tab title="Java" %}

```java
@Override
protected void onResume() {
    super.onResume();
    FID.INSTANCE.notifyActive(this);
    FPay.INSTANCE.notifyActive(this);
}

@Override
protected void onPause() {
    super.onPause();
    FID.INSTANCE.notifyInactive(this);
    FPay.INSTANCE.notifyInactive(this);
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
override fun onResume() {
    super.onResume()
    FID.notifyActive(this)
    FPay.notifyActive(this)
}

override fun onPause() {
    super.onPause()
    FID.notifyInactive(this)
    FPay.notifyInactive(this)
}
```

{% endtab %}
{% endtabs %}

## **Register callback**

{% tabs %}
{% tab title="Java" %}

```java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FID.INSTANCE.registerSDK(this);
    FPay.INSTANCE.register(this); 
}

@Override
protected void onDestroy() {
    super.onDestroy();
    FID.INSTANCE.unregisterSDK(this);
    FPay.INSTANCE.unregister(this);
}
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    FID.registerSDK(this)
    FPay.register(this)
}

override fun onDestroy() {
    super.onDestroy()
    FID.unregisterSDK(this)
    FPay.unregister(this)
}
```

{% endtab %}
{% endtabs %}

## Loading dynamic config

{% tabs %}
{% tab title="Java" %}

```java
FID.INSTANCE.loadingConfig(new FIDConfigCallBack() {
            @Override
            public void onMaintenance(@NonNull MaintenanceConfig maintenanceConfig) {
               //You app should show maintenance dialog of FID
            }

            @Override
            public void onSuccess() {
               //Must do other FID feature after load config success   
            }

            @Override
            public void onFail(@Nullable String error) {

            }
 });
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
FID.loadingConfig(object : FIDConfigCallBack {
            override fun onMaintenance(maintenanceConfig: MaintenanceConfig) {
               //You app should show maintenance dialog of FID
            }

            override fun onSuccess() {
               //Must do other FID feature after load config success               
            }

            override fun onFail(error: String?) {

            }
 })
```

{% endtab %}
{% endtabs %}
