---
title: "Integrate the Android SDK"
slug: "android-sdk-integration"
updated: 2026-06-09T21:19:22Z
published: 2026-06-09T21:19:22Z
canonical: "docs.xtremepush.com/android-sdk-integration"
stale: true
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xtremepush.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate the Android SDK

Use the Xtremepush SDK to integrate your Android app in the platform

1. In your Application.java file import the library:

```java
import ie.imobile.extremepush.PushConnector;
```

1. In the onCreate method of your Application.java file you must add the following:

**Java**

```java
public class YOUR_APPLICATION extends Application {
    public void onCreate() {
        super.onCreate();
...
        new PushConnector.Builder("XPUSH_APP_KEY", "GOOGLE_SENDER_ID")
            .create(this);
    }
```

**Kotlin**

```kotlin
public class YOUR_APPLICATION extends Application {
    public void onCreate() {
        super.onCreate();
...
        PushConnector.Builder("XPUSH_APP_KEY", "GOOGLE_SENDER_ID")
            .create(this);
    }
```

The command to initialise the PushConnector takes the parameter values in String format. *XPUSH_APP_KEY* is the SDK key provided when [adding the app to the platform](/documentation/docs/android-integration). *GOOGLE_SENDER_ID* is found as part of the steps in setting up [Android Push Notifications](/documentation/docs/android-push-notifications). The sender ID can also be omitted if not using push notifications.

1. In case your Xtremepush project is provisioned in US region add the following code when initialising the PushConnector before the call to `.create(this)`:

```java
.setServerUrl("https://sdk.us.xtremepush.com")
```
2. In the event your project is provisioned in the US Region or in a private cloud, alongside setting the Server URL, you will also need to implement Public Key Pinning. To do so:

```Java
new PushConnector.Builder(XPUSH_APP_KEY, GOOGLE_PROJECT_NUMBER)
        ...
        .setServerExpectedPublicKey(<THE PUBLIC KEY>)
        .create(this);
```
  1. a. You can use the following to retrieve the public key from Terminal:

```OpenSSL
openssl s_client -connect <serverURL>:443 -servername <serverURL> </dev/null 2>/dev/null \
| openssl x509 -pubkey -noout \
| openssl pkey -pubin -outform DER \
| xxd -p -c 256
```
  2. b. Then when initialising XP in PushConnector.builder use:
3. Finally, in each of your Activities, include a reference to our PushConnector object:

```java
import static ie.imobile.extremepush.PushConnector.mPushConnector;
```

> [!TIP]
> Make sure you set the user ID
> 
> It is recommended that at this stage you use our SDK method to set user IDs by following our [dedicated guide](/documentation/docs/set-user-id) to ensure devices can be associated and targeted in your campaigns by your own unique identifier.

## Orientation

If you are manually handling orientation changes and you are overriding the `OnConfigurationChanged` method, you will also need to add another PushConnector callback to each activity that overrides the `OnConfigurationChanged` method.

```java
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    mPushConnector.onRotation(this);
}
```

## Configuring Proguard

If you are using proguard on your app to minify, optimise, obfuscate etc. then you can add the following settings to your config file to ensure that Xtremepush continues to operate as expected:

```Text
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Application classes that will be serialized/deserialized over Gson
#-keep class com.google.gson.examples.android.model.** { *; }
-keep class ie.imobile.extremepush.api.model.** { *; }

# Recommended settings for other dependencies
-keep class com.loopj.android.** { *; }
-keep interface com.loopj.android.** { *; }
-keepclassmembers class ** {
@com.squareup.otto.Subscribe public *;
@com.squareup.otto.Produce public *;
}

# Required for inapp and inbox functionality
-keepclassmembers class * {
 @android.webkit.JavascriptInterface <methods>;
}

# Required for inbox functionality
-keepattributes JavascriptInterface
-keep public class ie.imobile.extremepush.ui.InboxActivity$InboxInterface
-keep public class * implements ie.imobile.extremepush.ui.InboxActivity$InboxInterface
-keepclassmembers class ie.imobile.extremepush.ui.InboxActivity$InboxInterface {
 <methods>;
}

# Required if building your app with Android 23 or lower
-dontwarn ie.imobile.extremepush.ui.PopupDialog
-dontwarn ie.imobile.extremepush.ui.WebViewActivity
```

## Retrieving your Xtremepush ID

If your device is successfully registering with the platform you should be able to retrieve your Xtremepush ID. This can be accomplished by calling the `getDeviceInfo()` method on your PushConnector as follows:

```java
mPushConnector.getDeviceInfo()
```

This method returns a map that contains your devices Cloud Messaging registration ID and its device ID obtained from Xtremepush. If your device has not received an ID then it has not successfully registered and there is an issue with your integration.

If you successfully retrieve the ID it can be used to identify your device on the platform and to send a push notification to just that device.

## Debugging

If you are debugging your app, you can turn on the Xtremepush debug logs by adding the following to the PushConnector.builder:

```java
.turnOnDebugLogs(true)
```

> [!WARNING]
> Debug logs can slow down your app and should be turned off before releasing the app.

## Excluding certain activities from connecting with Xtremepush

If you are integrating Xtremepush at an application level but would prefer if certain Activities didn't create a PushConnector object (for example, you do not want your splash screen to send the `onSessionStartEvent`, you want it to be sent on the Activity following), you can use the following method:

```java
PushConnector.addToExclusionList(ClassName.class.getSimpleName());
```
