public class DeployGate
extends java.lang.Object
install(Application)
on the onCreate() of
application class to enable crash reporting and application launch
notification.
In order to get working Remote LogCat feature, you also have to add
<uses-permission android:name="android.permission.READ_LOGS" />
in AndroidManifest.xml of your application.
Modifier and Type | Method and Description |
---|---|
static void |
composeComment()
Open comment composer screen for the distribution of the app installed.
|
static void |
composeComment(java.lang.String defaultComment)
Open comment composer screen for the distribution of the app installed with pre filled string.
|
static java.lang.String |
getAuthorUsername()
Get current app's author (e.g., User or Organzation) name on DeployGate.
|
static int |
getCurrentRevision()
Returns the revision of the app on DeployGate.
|
static int |
getDeployGateVersionCode()
Returns android:versionCode of DeployGate app.
|
static java.lang.String |
getDistributionId()
Returns the ID (40 digits hex string appears in URL) of the distribution if the app was installed through Distribution Page.
|
static java.lang.String |
getDistributionTitle()
Returns the title of the distribution if the app was installed through Distribution Page.
|
static java.lang.String |
getDistributionUrl()
Returns the URL of the distribution if the app was installed through Distribution Page.
|
static java.lang.String |
getDistributionUserName()
Get current user's name on Distribution Page.
|
static java.lang.String |
getLoginUsername()
Get current DeployGate username.
|
static java.lang.String |
getUpdateMessage()
Returns the message attached to the build.
|
int |
getUpdateRevision()
Returns the revision number of the update.
|
int |
getUpdateVersionCode()
Returns the android:versionCode of the update.
|
java.lang.String |
getUpdateVersionName()
Returns the android:versionName of the update.
|
boolean |
hasUpdate()
Check whether there's update of the app.
|
static void |
install(android.app.Application app)
Install DeployGate on your application instance.
|
static void |
install(android.app.Application app,
DeployGateCallback callback)
Install DeployGate on your application instance and register a callback
listener.
|
static void |
install(android.app.Application app,
DeployGateCallback callback,
boolean forceApplyOnReleaseBuild)
Install DeployGate on your application instance and register a callback
listener.
|
static void |
install(android.app.Application app,
java.lang.String author)
Install DeployGate on your application instance.
|
static void |
install(android.app.Application app,
java.lang.String author,
DeployGateCallback callback)
Install DeployGate on your application instance and register a callback
listener.
|
static void |
install(android.app.Application app,
java.lang.String author,
DeployGateCallback callback,
boolean forceApplyOnReleaseBuild)
Install DeployGate on your application instance and register a callback
listener.
|
static void |
installUpdate()
Start the installation of the latest version of the app if available.
|
static boolean |
isAuthorized()
Get whether current DeployGate user has this application in his/her
available list.
|
static boolean |
isDeployGateAvaliable()
Get whether DeployGate client service is available on this device.
|
static boolean |
isInitialized()
Get whether SDK is completed its intialization process and ready after
install(Application) . |
static boolean |
isManaged()
Get whether this application and its package is known and managed under
the DeployGate.
|
static void |
logDebug(java.lang.String message)
Record DEBUG level event on DeployGate.
|
static void |
logError(java.lang.String message)
Record ERROR level event on DeployGate.
|
static void |
logInfo(java.lang.String message)
Record INFO level event on DeployGate.
|
static void |
logVerbose(java.lang.String message)
Record VERBOSE level event on DeployGate.
|
static void |
logWarn(java.lang.String message)
Record WARN level event on DeployGate.
|
static void |
openComments()
Open comments screen for the distribution of the app installed.
|
static void |
refresh()
Request refreshing cached session values (e.g., isAuthorized, etc.) to
the DeployGate service.
|
static void |
registerCallback(DeployGateCallback listener,
boolean refreshImmediately)
Register a DeployGate event callback listener.
|
static void |
requestLogCat()
Capture current LogCat and send it.
|
static void |
unregisterCallback(DeployGateCallback listener)
Unregister a callback listener.
|
public static void install(android.app.Application app)
Application.onCreate()
once.
On a release build, which has android:isDebuggable set false on
AndroidManifest.xml, this function will do nothing. If you want to enable
DeployGate on a release build, consider using
install(Application, String, DeployGateCallback, boolean)
instead.
Note: To make isAuthorized()
more effective, you should
call install(Application, String)
instead and specify authorId
explicitly to ensure the authority of this app to prevent casual
redistribution via DeployGate.
app
- Application instance, typically just pass this.java.lang.IllegalStateException
- if this called twicepublic static void install(android.app.Application app, java.lang.String author)
Application.onCreate()
once.
On a release build, which has android:isDebuggable set false on
AndroidManifest.xml, this function will do nothing. If you want to enable
DeployGate on a release build, consider using
install(Application, String, DeployGateCallback, boolean)
instead.
app
- Application instance, typically just pass this.author
- author username of this app.java.lang.IllegalStateException
- if this called twicepublic static void install(android.app.Application app, DeployGateCallback callback)
Application.onCreate()
once.
On a release build, which has android:isDebuggable set false on
AndroidManifest.xml, this function will do nothing. If you want to enable
DeployGate on a release build, consider using
install(Application, String, DeployGateCallback, boolean)
instead.
Note: To make isAuthorized()
more effective, you should
call install(Application, String)
instead and specify authorId
explicitly to ensure the authority of this app to prevent casual
redistribution via DeployGate.
app
- Application instance, typically just pass this.callback
- Callback interface to listen events.java.lang.IllegalStateException
- if this called twicepublic static void install(android.app.Application app, java.lang.String author, DeployGateCallback callback)
Application.onCreate()
once.
On a release build, which has android:isDebuggable set false on
AndroidManifest.xml, this function will do nothing. If you want to enable
DeployGate on a release build, consider using
install(Application, String, DeployGateCallback, boolean)
instead.
app
- Application instance, typically just pass this.author
- author username of this app.callback
- Callback interface to listen events.java.lang.IllegalStateException
- if this called twicepublic static void install(android.app.Application app, DeployGateCallback callback, boolean forceApplyOnReleaseBuild)
Application.onCreate()
once.
Note: To make isAuthorized()
more effective, you should
call install(Application, String)
instead and specify authorId
explicitly to ensure the authority of this app to prevent casual
redistribution via DeployGate.
app
- Application instance, typically just pass this.callback
- Callback interface to listen events. Can be null.forceApplyOnReleaseBuild
- if you want to keep DeployGate alive on
the release build, set this true.java.lang.IllegalStateException
- if this called twicepublic static void install(android.app.Application app, java.lang.String author, DeployGateCallback callback, boolean forceApplyOnReleaseBuild)
Application.onCreate()
once.app
- Application instance, typically just pass this.author
- author username of this app. Can be null.callback
- Callback interface to listen events. Can be null.forceApplyOnReleaseBuild
- if you want to keep DeployGate alive on
the release build, set this true.public static void refresh()
install(Application)
or when refreshing is already in progress.
Note that after calling this, isInitialized()
will changed to
false immediately and any call to is*() will be blocked until
refreshing get finished.public static void registerCallback(DeployGateCallback listener, boolean refreshImmediately)
unregisterCallback(DeployGateCallback)
when the callback is no
longer needed (e.g., on destroying an activity.) If the listener has
already in the callback list, just ignored.listener
- callback listenerrefreshImmediately
- if you want to receive current states, set this
true.public static void unregisterCallback(DeployGateCallback listener)
listener
- callback listener to be removedpublic static boolean isInitialized()
install(Application)
. This call will never blocked.public static boolean isDeployGateAvaliable()
Note this function will block until SDK get ready after
install(Application)
called. So if you want to call this
function from the main thread, you should confirm that
isInitialized()
is true before calling this. (Or consider using
DeployGateCallback.onInitialized(boolean)
callback.)
public static boolean isManaged()
Note this function will block until SDK get ready after
install(Application)
called. So if you want to call this
function from the main thread, you should confirm that
isInitialized()
is true before calling this. (Or consider using
DeployGateCallback.onInitialized(boolean)
callback.)
public static boolean isAuthorized()
Note this function will block until SDK get ready after
install(Application)
called. So if you want to call this
function from the main thread, you should confirm that
isInitialized()
is true before calling this. (Or consider using
DeployGateCallback.onInitialized(boolean)
callback.)
public static java.lang.String getLoginUsername()
isAuthorized()
is true.
Note this function will block until SDK get ready after
install(Application)
called. So if you want to call this
function from the main thread, you should confirm that
isInitialized()
is true before calling this. (Or consider using
DeployGateCallback.onInitialized(boolean)
callback.)
public static java.lang.String getAuthorUsername()
Tip: If you want to prevent distributing your app by someone else
on the DeployGate, consider using install(Application, String)
.
Note this function will block until SDK get ready after
install(Application)
called. So if you want to call this
function from the main thread, you should confirm that
isInitialized()
is true before calling this. (Or consider using
DeployGateCallback.onInitialized(boolean)
callback.)
public static void logError(java.lang.String message)
isAuthorized()
is not true.message
- Message body to be send. May be truncated if it's too
long.public static void logWarn(java.lang.String message)
isAuthorized()
is not true.message
- Message body to be send. May be truncated if it's too
long.public static void logDebug(java.lang.String message)
isAuthorized()
is not true.message
- Message body to be send. May be truncated if it's too
long.public static void logInfo(java.lang.String message)
isAuthorized()
is not true.message
- Message body to be send. May be truncated if it's too
long.public static void logVerbose(java.lang.String message)
isAuthorized()
is not
true.message
- Message body to be send. May be truncated if it's too
long.public static void requestLogCat()
android.permission.READ_LOGS
is
declared on your app AndroidManifest.xml, or your app is running on
Android 4.1 or higher. If LogCat is not available, this function simply
does nothing.public static int getCurrentRevision()
public static java.lang.String getDistributionUrl()
public static java.lang.String getDistributionId()
public static java.lang.String getDistributionTitle()
public static int getDeployGateVersionCode()
public boolean hasUpdate()
getUpdateRevision()
, getUpdateVersionCode()
, getUpdateVersionName()
, and getUpdateMessage()
.public int getUpdateRevision()
hasUpdate()
is true.public int getUpdateVersionCode()
hasUpdate()
is true.public java.lang.String getUpdateVersionName()
hasUpdate()
is true.public static java.lang.String getUpdateMessage()
is not null,
this method returns Release Note that was entered when you published a new version on the page.
Otherwise this method returns the message that was entered when you upload a new build to DeployGate.
Requires DeployGate v1.7.0 or higher installed, otherwise this function always returns null.public static void installUpdate()
public static void openComments()
is null.
Requires DeployGate v1.7.0 or higher installed, otherwise this function produces no effect.public static void composeComment()
is null.
Requires DeployGate v1.7.0 or higher installed, otherwise this function produces no effect.public static void composeComment(java.lang.String defaultComment)
is null.
Requires DeployGate v1.7.0 or higher installed, otherwise this function produces no effect.defaultComment
- Default comment set to the editorpublic static java.lang.String getDistributionUserName()