Skip to main content

Veritran Docs

Initialization

Follow the steps below to initialize XpressPlug in native Android apps:

  1. Invoke the XpressPlug's init method, as shown below, where:

    • Application: References your project's Main Application object to obtain an execution context.

    • Constants Map: References configuration parameters.

    • Permissions List: References XpressPlug's modules.

    public static void init( 
        Application application,  
        Map<String, String> constants, 
        List<VeritranModule> permissions 
    ) 
  2. Invoke XpressPlug's start method:

    public static void start( 
        Activity activity,  
        StartAction.Callback callback 
    ) 

    Note

    The Activity parameter indicates where XpressPlug is executing from, and StartAction.Callback gives visibility of XpressPlug's initialization status. It allows you to identify if the configuration was successfully obtained, or track the download progress if needed. See the example and table below to see the possible callback methods.

    public interface Callback { 
        void onProgressMessageUpdate(String var1); 
        void onProgressPercentageUpdate(int var1); 
        void onFinish(); 
        void onXpressPlugNeedsUpdate(); 
        void onError(int var1, String var2); 
    } 

    onProgressMessageUpdate

    Is in charge of returning the XpressPlug's status to the main application.

    onProgressPercentageUpdate

    XpressPlug needs data connection to update certain functionalities. This function is in charge of showing the download progress for these updates.

    XpressPlugNeedsUpdate

    Is in charge of displaying if the application needs a more recent version of XpressPlug.

    onFinish

    Notifies that the start () method was executed correctly.

    onError

    Notifies that there was an error executing XpressPlug. It displays UA error codes and, in some cases, an error description. To learn more about these errors, go to Mobile Error Codes.

To obtain the Activity and Application parameters that XpressPlug requires, it is recommended to use two static variables within the MainApplication class in your Android project, as shown below: