Inicialización
[en] Follow the steps below to initialize XpressPlug in native Android apps:
[en] Invoke the XpressPlug's init method, as shown below, where:
[en] Application: References your project's Main Application object to obtain an execution context.
[en] Constants Map: References configuration parameters.
[en] Permissions List: References XpressPlug's modules.
public static void init( Application application, Map<String, String> constants, List<VeritranModule> permissions )
[en] Invoke XpressPlug's start method:
public static void start( Activity activity, StartAction.Callback callback )
Nota
[en] 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); }
[en] onProgressMessageUpdate
[en] Is in charge of returning the XpressPlug's status to the main application.
[en] onProgressPercentageUpdate
[en] XpressPlug needs data connection to update certain functionalities. This function is in charge of showing the download progress for these updates.
[en] XpressPlugNeedsUpdate
[en] Is in charge of displaying if the application needs a more recent version of XpressPlug.
[en] onFinish
[en] Notifies that the start () method was executed correctly.
[en] onError
[en] 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.
[en] 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: