Install App

After initializing the DTIS SDK, use the install() method to specify the target app you want to download. You can specify the target app by its unique package name or its APK file URI.

Kotlin
fun install(
  data: String, 
  callback: IResponseCallback<InstallationResponse, Error, InstallationProgress>? = null, 
  metadata: Bundle = Bundle(), 
  action: Bundle = Bundle(), 
  config: RequestConfig = RequestConfig()
)

Parameters

PARAMETER
STATUS
TYPE
DESCRIPTION

data

Required

String

Package name or URI of the app.

callback

Optional

Interface

The DTIS SDK includes the IResponseCallback interface for you to receive asynchronous status and progress updates throughout the installation lifecycle. You can receive installation progress by callbacks along with notifications by broadcasts.

If you do not wish to receive installation status notifications via callback, set this parameter to null.

For more information, see Notifications by Callback.

metadata

Optional

Bundle

Bundled data for further processing. Use this field to send the following information about the installation:

  • Data for direct app attribution. For more information, see Send MMP Attribution.

  • Key-value pair that specifies a particular version. For example, to install a specific APK version of MyFunGames, send the following string: bundle.putString(SdkConstants.HOST_APP_OPERATOR_TOKEN_NAME, "MyFunGames")

You can send any key-value pair in the metadata bundle. However, prior to sending the key-value pairs, inform DT which APK version you want to associate with each key-value pair.

action

Optional

Bundle

Bundle containing the broadcast to be triggered asynchronously as task progresses. In the bundle, specify the fully qualified class name of BroadcastReceiver to receive status and progress updates.

For example: com.myapp.receivers.MyBroadcastReceiver.kt

You can receive installation progress updates either by broadcasts, callbacks, or a combination of both.

For more information, see Notifications by Broadcast.

config

Optional

Object

An instance of a custom RequestConfig object, providing settings to override the default retry and timeout policies for the installation task. For more information, see Set Retry Policy.

Reconnecting to Ongoing Installations

If you call install() for an installation that is already in progress, the SDK attempts to reconnect to the existing installation task. To better monitor installation progress, DT recommends specifying a way of receiving installation status (either by callback or broadcast) to obtain a taskId that you can use to track task status and troubleshoot errors.

Examples

The following code snippets show how to call the install() method to install an app.

Install App by Package Name

The following snippet initiates the installation of an app identified by its package name.

Install App by URI

The following snippet initiates the installation of MyFunGame.apk by specifying its URI.

Last updated