MicroStrategy ONE

Customize Startup Activity for Android

Library Mobile SDK for Android supports setting up your own startup activity to add specific operations before the app launches.

  1. Set up the environment to use the Library Mobile for Android project. You are using this project as the basis for your customizations.
  2. Next, let's create the interface. Open the project in Android Studio.
  3. Switch your Tool window to the Project perspective.
  4. Navigate to src > main.
  5. Right-click the main folder and create a new directory named java, to hold all of your Java source files.

  6. Under the java directory, create a new package named com.example.

  7. Create a new java class named CustomizedStartupActivity under the package that extends the Activity interface.

  8. Define your operations within the class.

  9. After your customized operations are complete, create an intent to start MstrStartupActivity to launch the Library app.

    Copy
    private void launchMstrApp() {
        Intent intent = new Intent(this, MstrStartupActivity.class);
        Uri uriData = getIntent().getData();
        if(uriData != null) {
            //If application launched with URL, you can pass the URL to MstrStartupActivity
            intent.setData(uriData);
            intent.setAction(android.content.Intent.ACTION_VIEW);
        }
        startActivity(intent);
    }
  10. Navigate to src > main > AndroidManifest.xml. Replace the configuration of MstrStartupActivity to your CustomizedStartupActivity and set up MstrStartupActivity without intent-filter.

  11. Clean and rebuild the project.

The following code example uses CustomizedStartupActivity to display an alert dialog before the app launches. You can show this alert in the onCreate(Bundle savedInstanceState) method of the activity. The app launches after the user taps Continue to dismiss the alert.