Elevate Customer Engagement by Adding Google Play Instant to Your Android App
Learn how to make your Android app more accessible by using Google Play Instant, which allows users to try your app without having to download it.
Join the DZone community and get the full member experience.
Join For FreeUsers do not need to install your game or app since Google Play Instant offers an immediate option to access it. This enhances the overall experience for the customer and can greatly increase your app's conversion rates. The possibilities with Google Play Instant are endless. It offers the chance to allow users to try the app or game instantly before they make the full commitment of downloading it. This makes it less intimidating and more encouraging, which leads to an increase in downloads and more engagement in the future.
In this article, we are going to show you step by step how you can add Google Play Instant to your Android application. From the very first steps to the intricate details, with our help, you will avoid common mistakes that developers tend to make.
Benefits of Using Google Play Instant
With millions of applications available on the Google Play Store, the app market is very competitive. Developers face a challenge of convincing users to download their app, which is made harder due to the large app sizes, low data speed, and vague functionalities.
Google Play Instant resolves these issues by:
- Reducing user hesitation – Users can preview the crucial aspects of your app and interact with it immediately.
- Enhancing discoverability – Instant experiences allow products and services to be featured or searchable straight away.
- Fulfilling the increased conversion rates – Having a sample version of your app available significantly increases the chances of users installing the complete version.
- Minimizing concern of space needed – Users are always annoyed with needing their storage space taken just to sample an app.
- Simplifying onboarding – Offering an app sample allows for immediate value recognition, which minimizes bounced users after installing.
Leading apps like Clash Royale and TikTok have already reaped the benefits with increased engagement and conversion metrics with the help of Google Play Instant. Your app can also experience similar gains through the adoption of Instant due to ease of use.
Goal of This Guide
By completing this tutorial, you will know how to:
- Modularize your Android project to make it compatible with Instant
- Build and adjust the settings of Instant app modules
- Configure manifests and Gradle files
- Test and publish the instant app
- Avoid the most frequent mistakes
We expect that you already know how to operate Android Studio and work with Android App Bundles (AAB).
Modularizing Your App
There are certain requirements that need to be fulfilled, such as modularization:
- Base feature module – holds code that is common for your app and can be reused
- Instant module – works as an entry point to your instant experience
Creating the Base Module
In case your app is not modularized:
- Refactor the app into a dynamic feature module called
Base. - Migrate the shared UI and logic to this module.
In Android Studio:
- Right click your project > New > Dynamic Feature Module.
- Set it as install-time and enable fusing.
Example Gradle configuration (base/build.gradle):
apply plugin: 'com.android.dynamic-feature'
android {
defaultConfig {
minSdkVersion 21
}
}
Adding the Instant App Module
Create the instant app module:
- Select New > Module > Instant App Module.
- Give it the name
instant. - Modify
instant/build.gradle. - Apply the following changes:
apply plugin: 'com.android.instantapp'
dependencies {
implementation project(':base')
}
Your currently assembled modules' structure includes:
:base– common code:instant– instant access:app– main installable app
Configuring AndroidManifest.xml
Define a light, instant-compatible activity type in base/src/main/AndroidManifest.xml:
<activity
android:name=".InstantMainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Avoid using blocked libraries and non-compatible Instant APIs in the entry activity.
Take InstantMainActivity.kt, for example:
import android.os.Bundle
import android.widget.Button
import androidx.appcompat.app.AppCompatActivity
import com.google.android.instantapps.InstantApps
class InstantMainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activityinstantmain)
val installButton = findViewById<Button>(R.id.installButton)
installButton.setOnClickListener {
val manager = InstantApps.getPackageManager(this)
manager.showInstallPrompt(this, null, 0, null)
}
}
}
Make sure your design (activityinstantmain.xml) has:
<Button
android:id="@+id/installButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Install Full App" />
Configuring Gradle and Module Dependencies
Verify that all modules appear in settings.gradle: include :app, :base, and :instant.
In your app/build.gradle:
dependencies {
implementation project(':base')
}
Validating Your Instant App
On Android Studio:
- Go to Edit Run Configurations.
- Click on Instant App.
- Select the instant module alongside your test device.
- Run and view the instant app in action.
Marketing Your Instant App
In order to publish to the play store:
- Use Android App Bundles (.aab).
- Sign the instant app with the appropriate upload key for Google.
- Build your bundle by selecting Build > Build Bundle(s).
- Upload to Google Play Console in the section Release > Instant Apps.
- Test them with internal releases before rolling them out to the public.
Common Developer Oversights
Below are some of the most common mistakes and ways to mitigate them:
- Adding large or unneeded dependencies – Keep your instant modules under 15MB. Refrain from adding heavy assets and unnecessary libraries.
- Incorrect manifest files – Remember to check intent filters and exported attributes so that you do not have load failures.
- Neglecting testing on actual devices – Actual devices tend to expose some issues that emulators fail to showcase.
- Using restricted APIs – There are numerous limits imposed on instant apps, like background services, some implicit intents, and certain content providers. Stick to Instant Apps restrictions and prohibited policy controls, and follow Google's API list.
- Lacking an effective transition to the full app – There must be a streamlined path from the Instant preview to the download of the full app for users.
Closing Thoughts
Having a Google Play Instant implementation will greatly assist in enhancing the accessibility and appealing nature of your application. It removes considerable friction and provides a smoother experience when users are given the option to test out their apps without the need to install them.
Integrating Instant shall be beneficial to any utility application or fast-paced game alike. Just a glimpse is often enough to entice users to download the full version of the game. Make sure you build it correctly, as you’re bound to get more engagement and stronger conversions as well.
I hope you enjoyed following along, and I wish you the very best in your endeavors with Google Play Instant.
Opinions expressed by DZone contributors are their own.
Comments