Package 

Class DeployGate


  • 
    public class DeployGate
    
                        

    This is DeployGate SDK library. Import this library to the application package and call install 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.

    • Method Detail

      • install

         static void install(Application app)

        Install DeployGate on your application instance. Call this method insideof your onCreate once.

        On a release build, which has android:isDebuggable set false onAndroidManifest.xml, this function will do nothing. If you want to enableDeployGate on a release build, consider using install instead.

        Note: To make isAuthorized more effective, you shouldcall install instead and specify authorIdexplicitly to ensure the authority of this app to prevent casualredistribution via DeployGate.

        Parameters:
        app - Application instance, typically just pass this.
      • install

         static void install(Application app, String author)

        Install DeployGate on your application instance. Call this method insideof your onCreate once.

        On a release build, which has android:isDebuggable set false onAndroidManifest.xml, this function will do nothing. If you want to enableDeployGate on a release build, consider using install instead.

        Parameters:
        app - Application instance, typically just pass this.
        author - author username of this app.
      • install

         static void install(Application app, DeployGateCallback callback)

        Install DeployGate on your application instance and register a callbacklistener. Call this method inside of your onCreate once.

        On a release build, which has android:isDebuggable set false onAndroidManifest.xml, this function will do nothing. If you want to enableDeployGate on a release build, consider using install instead.

        Note: To make isAuthorized more effective, you shouldcall install instead and specify authorIdexplicitly to ensure the authority of this app to prevent casualredistribution via DeployGate.

        Parameters:
        app - Application instance, typically just pass this.
        callback - Callback interface to listen events.
      • install

         static void install(Application app, boolean forceApplyOnReleaseBuild)

        Install DeployGate on your application instance and register a callbacklistener. Call this method inside of your onCreate once.

        Note: To make isAuthorized more effective, you shouldcall install instead and specify authorIdexplicitly to ensure the authority of this app to prevent casualredistribution via DeployGate.

        Parameters:
        app - Application instance, typically just pass this.
        forceApplyOnReleaseBuild - if you want to keep DeployGate alive onthe release build, set this true.
      • install

         static void install(Application app, String author, DeployGateCallback callback)

        Install DeployGate on your application instance and register a callbacklistener. Call this method inside of your onCreate once.

        On a release build, which has android:isDebuggable set false onAndroidManifest.xml, this function will do nothing. If you want to enableDeployGate on a release build, consider using install instead.

        Parameters:
        app - Application instance, typically just pass this.
        author - author username of this app.
        callback - Callback interface to listen events.
      • install

         static void install(Application app, DeployGateCallback callback, boolean forceApplyOnReleaseBuild)

        Install DeployGate on your application instance and register a callbacklistener. Call this method inside of your onCreate once.

        Note: To make isAuthorized more effective, you shouldcall install instead and specify authorIdexplicitly to ensure the authority of this app to prevent casualredistribution via DeployGate.

        Parameters:
        app - Application instance, typically just pass this.
        callback - Callback interface to listen events.
        forceApplyOnReleaseBuild - if you want to keep DeployGate alive onthe release build, set this true.
      • install

         static void install(Application app, String author, DeployGateCallback callback, boolean forceApplyOnReleaseBuild)

        Install DeployGate on your application instance and register a callbacklistener. Call this method inside of your onCreate once.

        Parameters:
        app - Application instance, typically just pass this.
        author - author username of this app.
        callback - Callback interface to listen events.
        forceApplyOnReleaseBuild - if you want to keep DeployGate alive onthe release build, set this true.
      • install

         static void install(Application app, String author, DeployGateCallback callback, boolean forceApplyOnReleaseBuild, CustomLogConfiguration customLogConfiguration)

        Install DeployGate on your application instance and register a callbacklistener. Call this method inside of your onCreate once.

        Parameters:
        app - Application instance, typically just pass this.
        author - author username of this app.
        callback - Callback interface to listen events.
        forceApplyOnReleaseBuild - if you want to keep DeployGate alive onthe release build, set this true.
        customLogConfiguration - set a configuration for custom logging
      • refresh

         static void refresh()

        Request refreshing cached session values (e.g., isAuthorized, etc.) tothe DeployGate service. Nothing happens if this called before install or when refreshing is already in progress.Note that after calling this, isInitialized will changed tofalse immediately and any call to is*() will be blocked untilrefreshing get finished.

      • registerCaptureCreateCallback

         static void registerCaptureCreateCallback(DeployGateCaptureCreateCallback callback)

        Register a callback listener about the new capture is created.Don't forget to unregister the callback listener when it is no longer needed (e.g., on destroying an activity.)If the listener has already in the callback list, just ignored.

        Parameters:
        callback - callback listener
      • registerCallback

        @Deprecated() static void registerCallback(DeployGateCallback listener, boolean refreshImmediately)

        Register a DeployGate event callback listener. Don't forget to call unregisterCallback when the callback is nolonger needed (e.g., on destroying an activity.) If the listener hasalready in the callback list, just ignored.

        Parameters:
        listener - callback listener
        refreshImmediately - if you want to receive current states, set thistrue.
      • unregisterCallback

        @Deprecated() static void unregisterCallback(DeployGateCallback listener)

        Unregister a callback listener. If the listener was not registered, justignored.

        Parameters:
        listener - callback listener to be removed
      • isInitialized

         static boolean isInitialized()

        Get whether SDK is completed its intialization process and ready after install. This call will never blocked.

      • isDeployGateAvaliable

         static boolean isDeployGateAvaliable()

        Get whether DeployGate client service is available on this device.

        Note this function will block until SDK get ready after install called. So if you want to call thisfunction from the main thread, you should confirm that isInitialized is true before calling this. (Or consider using onInitialized callback.)

      • isManaged

         static boolean isManaged()

        Get whether this application and its package is known and managed underthe DeployGate.

        Note this function will block until SDK get ready after install called. So if you want to call thisfunction from the main thread, you should confirm that isInitialized is true before calling this. (Or consider using onInitialized callback.)

      • isAuthorized

         static boolean isAuthorized()

        Get whether current DeployGate user has this application in his/heravailable list. You may want to check this value on initializationprocess of the main activity if you want to limit user of thisapplication to only who you explicitly allowed.

        Note this function will block until SDK get ready after install called. So if you want to call thisfunction from the main thread, you should confirm that isInitialized is true before calling this. (Or consider using onInitialized callback.)

      • getLoginUsername

         static String getLoginUsername()

        Get current DeployGate username. This function only available when isAuthorized is true.

        Note this function will block until SDK get ready after install called. So if you want to call thisfunction from the main thread, you should confirm that isInitialized is true before calling this. (Or consider using onInitialized callback.)

      • getAuthorUsername

         static String getAuthorUsername()

        Get current app's author (e.g., User or Organzation) name on DeployGate. Youmay use this value to check the app was distributed by yourself orsomeone else.

        Tip: If you want to prevent distributing your app by someone elseon the DeployGate, consider using install.

        Note this function will block until SDK get ready after install called. So if you want to call thisfunction from the main thread, you should confirm that isInitialized is true before calling this. (Or consider using onInitialized callback.)

      • logError

         static void logError(String message)

        Record ERROR level event on DeployGate. Log message will immediately sendto the server so you may see it on your dashboard. Nothing happen whenDeployGate is not available, i.e. isAuthorized is not true.

        Parameters:
        message - Message body to be send.
      • logWarn

         static void logWarn(String message)

        Record WARN level event on DeployGate. Log message will immediately sendto the server so you may see it on your dashboard. Nothing happen whenDeployGate is not available, i.e. isAuthorized is not true.

        Parameters:
        message - Message body to be send.
      • logDebug

         static void logDebug(String message)

        Record DEBUG level event on DeployGate. Log message will immediately sendto the server so you may see it on your dashboard. Nothing happen whenDeployGate is not available, i.e. isAuthorized is not true.

        Parameters:
        message - Message body to be send.
      • logInfo

         static void logInfo(String message)

        Record INFO level event on DeployGate. Log message will immediately sendto the server so you may see it on your dashboard. Nothing happen whenDeployGate is not available, i.e. isAuthorized is not true.

        Parameters:
        message - Message body to be send.
      • logVerbose

         static void logVerbose(String message)

        Record VERBOSE level event on DeployGate. Log message will immediatelysend to the server so you may see it on your dashboard. Nothing happenwhen DeployGate is not available, i.e. isAuthorized is nottrue.

        Parameters:
        message - Message body to be send.
      • requestLogCat

         static void requestLogCat()

        Capture current LogCat and send it. This call will work asynchronously.Capturing LogCat requires android.permission.READ_LOGS isdeclared on your app AndroidManifest.xml, or your app is running onAndroid 4.1 or higher. If LogCat is not available, this function simplydoes nothing.

      • getCurrentRevision

         static int getCurrentRevision()

        Returns the revision of the app on DeployGate.The revision number is automatically incremented integer value every time you upload a build to DeployGate,so you can identify the build explicitly.

        Requires DeployGate v1.7.0 or higher installed, otherwise this function always returns 0.

      • getDistributionUrl

         static String getDistributionUrl()

        Returns the URL of the distribution if the app was installed through Distribution Page.

        Requires DeployGate v1.7.0 or higher installed, otherwise this function always returns null.

      • getDistributionId

         static String getDistributionId()

        Returns the ID (40 digits hex string appears in URL) of the distribution if the app was installed through Distribution Page.

        Requires DeployGate v1.7.0 or higher installed, otherwise this function always returns null.

      • getDistributionTitle

         static String getDistributionTitle()

        Returns the title of the distribution if the app was installed through Distribution Page.

        Requires DeployGate v1.7.0 or higher installed, otherwise this function always returns null.

      • getUpdateRevision

         static int getUpdateRevision()

        Returns the revision number of the update. The value is only valid when hasUpdate is true.

      • getUpdateVersionCode

         static int getUpdateVersionCode()

        Returns the android:versionCode of the update. The value is only valid when hasUpdate is true.

      • getUpdateMessage

         static String getUpdateMessage()

        Returns the message attached to the build.If the app was installed via Distribution Page (i.e. 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.

      • installUpdate

         static void installUpdate()

        Start the installation of the latest version of the app if available. No effects if there's no update.

        Requires DeployGate v1.7.0 or higher installed, otherwise this function produces no effect.

      • openComments

         static void openComments()

        Open comments screen for the distribution of the app installed.No effect if the app was installed via Distribution Page (i.e. is null.

        Requires DeployGate v1.7.0 or higher installed, otherwise this function produces no effect.

      • composeComment

         static void composeComment()

        Open comment composer screen for the distribution of the app installed.No effect if the app was installed via Distribution Page (i.e. is null.

        Requires DeployGate v1.7.0 or higher installed, otherwise this function produces no effect.

      • composeComment

         static void composeComment(String defaultComment)

        Open comment composer screen for the distribution of the app installed with pre filled string.No effect if the app was installed via Distribution Page (i.e. is null.

        Requires DeployGate v1.7.0 or higher installed, otherwise this function produces no effect.

        Parameters:
        defaultComment - Default comment set to the editor
      • getDistributionUserName

         static String getDistributionUserName()

        Get current user's name on Distribution Page. Default name is randomly generated string (like "[abcd1234]").

        Requires DeployGate v1.7.0 or higher installed, otherwise this function returns null.