Automatically Launching a Workflow Application

If you anticipate using the Hybrid Web Container only for a single Hybrid Web application, you can customize the Hybrid Web Container to launch the application directly at start-up.

The related comment tage is ANDROID_CUSTOMIZATION_POINT_AUTOSTART.

  1. Open the UiHybridAppMessagesScreen.java file for editing and navigate to the public void onCreate( Bundle ) function.
  2. Insert the following lines of code just before the “m_sBaseTitle = this.getTitle().toString();” line.
    HybridApp [] aoHybridApps = HybridAppDb.getInvocableHybridApps();
    if(aoHybridApps.length >= 1)
    {
       Intent oIntentHybridAppContainer =  new Intent( this, UiHybridAppContainer.class );
       oIntentHybridAppContainer.putExtra( Consts.INTENT_PARAM_WORKFLOW_START_MODE, Consts.START_MODE_WORKFLOW );
       oIntentHybridAppContainer.putExtra( Consts.INTENT_PARAM_WORKFLOW_ID, ((HybridAppDb)aoHybridApps[0]).getHybridAppId() );
       oIntentHybridAppContainer.putExtra( Consts.INTENT_PARAM_WORKFLOW_PROGRESS_TEXT, aoHybridApps[0].getDisplayName() );
       startActivityForResult( oIntentHybridAppContainer, Consts.INTENT_ID_WORKFLOW_CONTAINER );
    }
    
  3. To close the Hybrid Web Container when the application is finished executing, insert this code after the if{…} in the public void onActivityResult(…) function:
    else
    {
       finish();
    }
    
    Note: Implementing this step causes the Hybrid Web Container to exit when the Workflow application exits, so the user cannot navigate to the messages screen. Skip this step to go to the messages screen when exiting the Workflow application.