androidandroid-instant-appsdynamic-feature-module

Instant Dynamic Feature with Dynamic feature guide


I'm confused with the dynamic instant app documentation setup guide from android itself, therefore guidance and links are much appreciated :)

What I understood from reading the documents is the actual "app" will convert into "base", creating another Dynamic Module will be "app" with no layouts as well for Instant Dynamic Module. This is the part where I'm confused, If not mistaken, lets say I wanted my second page to show as Instant App, the app link will needed assigned to instant app, how do I assign it? what is the next step? do correct my understanding if I'm wrong.

my App has 2 pages, second page will contains a button, what I have done based on documentation:

  1. done = implementation "com.google.android.gms:play-services-instantapps:17.0.0"

  2. done = android:targetSandboxVersion="2"

  3. done = <dist:module dist:instant="true" />

  4. done = `cleartextTrafficPermitted

  5. Added to onCreate in second activity =

    private void showInstallPrompt() {
             Intent postInstall = new Intent(Intent.ACTION_MAIN)
                     .addCategory(Intent.CATEGORY_DEFAULT)
                     .setPackage(your-installed-experience-package-name);
    
             // The request code is passed to startActivityForResult().
             InstantApps.showInstallPrompt(MyInstantExperienceActivity.this,
                     postInstall, request-code, /* referrer= */ null);
         }
    
  6. Create a new Dynamic module and automatically added in both build.gradle

    a) implementation project(":app")

    b) dynamicFeatures = [":installed_feature"]

  7. App link already setup with host scheme

  8. Created Instant Dynamic Feature module

  9. what is the next step?


Solution

  • To get started we recommend taking a look at the guide here.
    Also, there is a suite of samples available. I recommend you start with aab-simple.

    Initially, you can create an Google Play Instant experience without modularizing into multiple com.android.dynamic-feature modules. But if you want to be able to download features later on, you will have to start looking into feature modules.

    Also you can let us know what parts you are missing in the documentation by filing a bug as this helps us to improve the situation.