Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rudderlabs/rudder-sdk-android

Android SDK for RudderStack - the Customer Data Platform for Developers.
https://github.com/rudderlabs/rudder-sdk-android

analytics analytics-platform android android-library android-sdk java kotlin open-source rudder sdk

Last synced: 3 months ago
JSON representation

Android SDK for RudderStack - the Customer Data Platform for Developers.

Awesome Lists containing this project

README

        





The Customer Data Platform for Developers







Website
·
Documentation
·
Community Slack

---

# RudderStack Android SDK

RudderStack's Android SDK lets you track event data from your Android applications. After integrating the SDK, you will be able to send the event data to your preferred destination/s such as Google Analytics, Amplitude, and more.

For detailed documentation on the Android SDK, click [**here**](https://rudderstack.com/docs/stream-sources/rudderstack-sdk-integration-guides/rudderstack-android-sdk).

## Get started with the Android SDK

1. Add these lines to your project level `build.gradle` file:

```groovy
buildscript {
repositories {
mavenCentral()
}
}

allprojects {
repositories {
mavenCentral()
}
}
```

2. Then, add the dependency under `dependencies` as shown:

```groovy

implementation 'com.rudderstack.android.sdk:core:1.x.x'
```

## Initializing ```RudderClient```

```
val rudderClient: RudderClient = RudderClient.getInstance(
this,
,
RudderConfig.Builder()
.withDataPlaneUrl()
.build()
)
```
or (compatible with existing Segment code)
```
RudderClient.Builder builder = new RudderClient.Builder(this, );
RudderClient.setSingletonInstance(builder.build());
```

## Sending events
```
rudderClient.track(
RudderMessageBuilder()
.setEventName("some_custom_event")
.setProperty(
TrackPropertyBuilder()
.setCategory("test_category")
.build()
)
.setUserId("test_user_id")
)
```
or (compatible with existing Segment instrumentation code)
```
String customEvent = "some_custom_event";
String propertyKey = "some_property_key";
String propertyValue = "some_property_value";
RudderClient.with(this).track(
customEvent,
new RudderProperty().putValue(propertyKey, propertyValue)
);
```

For more information on the different types of events supported by the Android SDK, refer to our [**docs**](https://rudderstack.com/docs/stream-sources/rudderstack-sdk-integration-guides/rudderstack-android-sdk).

## Registering your callbacks

For device mode destinations, you can register callbacks, which will be executed after the native SDK has been successfully initialized. Use the `onIntegrationReady` method to register your callback.

The following snippet shows an example:

```
rudderClient.onIntegrationReady("Lotame") {
var nativeSDK = (it as LotameIntegration)
// your custom code
}
```
The variable `it` contains the intialized nativeSDK object.

> The method `onIntegrationReady` accepts two arguments: the integration name (e.g. "Lotame") and the callback.

[**Registering Lotame's onSync callback**](https://github.com/rudderlabs/rudder-integration-lotame-android#register-your-onsync-callback) shows one more example of registering a callback using `onIntegrationReady`.

## Contribute

We would love to see you contribute to this project. Get more information on how to contribute [**here**](./CONTRIBUTING.md).

## About RudderStack

[**RudderStack**](https://rudderstack.com/) is a **customer data platform for developers**. Our tooling makes it easy to deploy pipelines that collect customer data from every app, website and SaaS platform, then activate it in your warehouse and business tools.

More information on RudderStack can be found [**here**](https://github.com/rudderlabs/rudder-server).

## Contact us

For more support on using the RudderStack Android SDK, you can [**contact us**](https://rudderstack.com/contact/) or start a conversation on our [**Slack**](https://rudderstack.com/join-rudderstack-slack-community) channel.