# Android

{% hint style="danger" %}
This document refers to deprecated parts of the platform and has been left intact to help customers with legacy integrations. In order to access the latest platform features and documentation, please go to <https://docs.sentiance.com>.
{% endhint %}

## Migrating from 3.x to 4.x

{% hint style="info" %}
This update brings Android Oreo compatibility. You will now be able to target API level 26.
{% endhint %}

### SDK Initialization

Initializing the SDK is done by calling the [`init()`](https://legacy-docs.sentiance.com/api-reference/android/sentiance#init) method and passing an [`SdkConfig`](https://legacy-docs.sentiance.com/sdk/api-reference/android/sdkconfig) object.[`SdkConfig.Builder`](https://legacy-docs.sentiance.com/sdk/api-reference/android/sdkconfig/sdkconfig-builder) now expects a notification as the 3rd parameter. `enableForeground(notification)` is no longer available for this purpose. The SDK will show a notification depending on the OS version, targeted API level, and remote app configuration.

### SDK Control

The `stopAfter(seconds)` method is no longer available.

### User Metadata

User metadata methods no longer accept `MetadataCallback` as a 3rd parameter. Adding and removing metadata is now done asynchronously via the payload submission system.

### External Events

Registering external events is no longer available.

### Trip Control

#### Starting and Stopping Trips

\`\`[`startTrip()`](https://legacy-docs.sentiance.com/api-reference/android/sentiance#starttrip) and [`stopTrip()`](https://legacy-docs.sentiance.com/api-reference/android/sentiance#starttrip) methods now require [`StartTripCallback`](https://legacy-docs.sentiance.com/sdk/api-reference/android/trip/starttripcallback) and [`StopTripCallback`](https://legacy-docs.sentiance.com/sdk/api-reference/android/trip/stoptripcallback) parameters respectively.

#### Trip Details

The SDK no longer returns a `Trip` object when a trip is stopped. The [`onTripTimeout()`](https://legacy-docs.sentiance.com/api-reference/android/trip/triptimeoutlistener#ontriptimeout)method of [`TripTimeoutListener`](https://legacy-docs.sentiance.com/sdk/api-reference/android/trip/triptimeoutlistener) no longer returns a `Trip` object. Similarly, the `onTripStopped()` method of [`StopTripCallback`](https://legacy-docs.sentiance.com/sdk/api-reference/android/trip/stoptripcallback) no longer exists. This interface now provides an [`onSuccess()`](https://legacy-docs.sentiance.com/api-reference/android/trip/stoptripcallback#onsuccess) and [`onFailure(sdkStatus)`](https://legacy-docs.sentiance.com/api-reference/android/trip/stoptripcallback#onfailure) methods.

#### Checking Ongoing Trips

The [`isTripOngoing()`](https://legacy-docs.sentiance.com/api-reference/android/sentiance#istripongoing) method now expects a parameter of type [`TripType`](https://legacy-docs.sentiance.com/sdk/api-reference/android/trip/triptype).

### Callbacks

All callback and listener methods are now executed on the application's main thread. If you perform any long running or network operations directly in the callbacks, please take care to move them to a background thread instead.

### Other

`getWiFiLastSeenTimestamp()` is no longer available.

The [`CrashCallback`](https://legacy-docs.sentiance.com/sdk/api-reference/android/crashdetection/crashcallback)'s Location parameter is now `@Nullable`.
