DeployGate SDK for Android

To use advanced feature of DeployGate, you need to integrate SDK into your app.

First note that you may use basic features of DeployGate without installing the SDK. Once you drop your current app package onto DeployGate, you may download it through DeployGate immediately, watch how installation is going on the dashboard and further app updates can also be pushed over the air.

Installing the DeployGate SDK into your project enables powerful features, such as crash reporting, remote LogCat and user authentication.

Since installing the DeployGate SDK is fairly simple, just adding a jar file and inserting a line to your application, we highly recommend to do so. DeployGate SDK functions are automatically disabled in release builds.

without SDK with SDK + permissions
Over the Air Deploy
Update Notification
Installation Reporting
Crash Reporting
App Boot Reporting
User Authorization
Kill Switch
Remote LogCat

1. Edit build.gradle

Add following lines to the build.gradle (Module: app) file.
repositories {
    jcenter()
}

dependencies {
    compile 'com.deploygate:sdk:4.0.0'
}

2. Click "Sync Project With Gradle Files" button of AndroidStudio.

Sync project with gradle files

3. Build and upload your application to DeployGate

If you are using Gradle DeployGate Plugin, all you have to do is running uploadDeployGateDebug task.

Now you are ready to receive boot and crash report for builds installed through DeployGate. If you want to use Remote LogCat, continue proceeding to next section.

Sample Codes
The source code of sample app integrated with SDK is public on the GitHub.


Android 4.1 or higher On the devices running Android 4.1 (Jelly Bean) or higher, Remote LogCat works without adding the permission. However, for security reasons, you can only see the log produced by your app process.

DeployGate provides wireless LogCat mechanism called Remote LogCat. Once you choose the device to see logs from your dashboard, the request directed to the device then DeployGate client and SDK in your app receive and start transferring LogCat.

In order to collect LogCat lines from your app, you have to add some permission request on your AndroidManifest.xml.

Hint Crash reporting will work without this setting.

Alternative You don't need to change the setting if you use the logging mechanism of DeployGate

1. Open AndroidManifest.xml

2. Add following uses-permission declaration under your <manifest> definition.
<uses-permission android:name="android.permission.READ_LOGS" />

3. Rebuild your app and push it.

DeployGate SDK will automatically recognize this change and is ready to receive requests. You may see wireless LogCat working the devices on your app's dashboard page.

In some cases, you may want to restrict app distribution only to users you explicitly allowed.

Since app packages on the Android devices can be extracted by anyone, without root privileges, restricting file distribution itself is not enough to protect your app.

DeployGate SDK provides several functions to check if the user has a privilege to use your app, in other words, if the current DeployGate user has your app on the list.

DeployGate.isDeployGateAvailable()

Returns whether the DeployGate client app is installed.


DeployGate.isAuthorized()

Returns this app is in the current user's list (only if above is true.)


DeployGate.getLoginUsername()

Returns the current user's name (only if both above is true.)


DeployGate.getAuthorUsername()

Returns app's author (i.e. distributor) username. #install(Application, Username) is also available to ensure the distributor of the app.

You can send an arbitrary string as a log by calling DeployGate.logError(), DeployGate.logWarn(), DeployGate.logDebug(), DeployGate.logInfo() and DeployGate.logVerbose(). The log sent by this method will be shown on your timeline in realtime.

Tip: This will not require READ_LOGS permission so if you can log whatever you want with this way, you don't have to change your app manifest.

Heads Up Since there is no filtering mechanism available on the timeline in current, you should consider carefully how much events to log. This will be improved in near future.


Ask questions, share your tips or help others at our forum.