DeployGate SDK for Android
To use advanced feature of DeployGate, you need to integrate SDK into your app.
When is the SDK needed?
DeployGate features with and without SDK
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 |
How To Install
Install SDK into your project
1. Edit build.gradle
repositories {
jcenter()
}
dependencies {
compile 'com.deploygate:sdk:4.3.0'
}
2. Click "Sync Project With Gradle Files" button of AndroidStudio.

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.
Enable Remote LogCat
Additional permission required
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.
User Authorization
Restricting app distribution to known users
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.
Record Events to Log
Customized log to record specific events
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.
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.