Everything you should know about Google Play Instant and Bubbles
Image of a man looking at phone

The COVID-19 forced social distancing and lockdown policies are driving a steady rise in mobile app usage. In Q3 of 2020 alone, 28.3 billion new Android apps were downloaded from Google Play. Mobile users worldwide have spent 180 billion collective hours each month of the third quarter, with a whopping spend of $28 billion on technology apps. It is estimated that the app downloads will increase up to 352.9 billion by 2021. Undoubtedly, the future of Android apps is quite promising.

However, with this immense growth in the usage of Android apps, a never-ending competition can be experienced. Today’s app users are spoilt for choices, to grab their attention and make them use your app, you must come up with an Android app that is trending, which has a user-friendly interface, and matches the current bar of digitization. To do so, one must have a perfect knowledge of the technologies that can help create a user-friendly. modern and robust Android app. So, in this blog, we will take a close look at two recent exciting Android app development features that can transform your next mobile app. Let us start.

Google Play Instant

With Google Play Instant, Android users can start using an app or game without installing it. This feature enables app developers to showcase the capabilities of a new application. It delivers opportunities to increase engagement with your new Android app and gain more installs by surfacing your Instant app across the Play Store.

Instant apps aren’t new in development, but they have gained immense popularity recently. Instant apps are very useful for e-commerce apps and games. Such an app allows the user to try a particular app or game for a while without installing it. After the trial period is over, users can decide whether to download and install the game onto their device or not.

Google Play Instant enables native apps and games to launch on devices running on Android 5.0 (API level 21) or higher without being installed. You can build instant apps and games utilizing Android development tools.

How does the instant experience work?

Android users can tap on a button at Play Store, Google Play Games app, or a website banner to start using Instant apps or games without installing it on their device. However, before you checkout these new experiences, here are some pointers you need to keep in mind.

Instant “Try” Experience in the Play Store

Instant apps or games are shown with a “Try Now” button in the Play Store (as shown in the figure above). This type of experience is typically a smaller and trial version of the original app or game created to drive installs. For example, game developers may want to build the first level of their game as an instant experience and then prompt users to install the full game.

Conditions applicable for Instant App and Game Development
  1. Instant-enabled app bundles can only use few permissions such as ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION, ACCESS_NETWORK_STATE, CAMERA, INSTANT_APP_FOREGROUND_SERVICE (only on Android 8.0 API level 26 and higher), INTERNET, READ_PHONE_NUMBERS (only on Android 8.0 API level 26 and higher), RECORD_AUDIO, VIBRATE, WAKE_LOCK
  2. When developing an Instant app, keep in mind that it cannot interact with installed apps on a device unless one of the following is true:
  • One or more activities within an installed app have set its android:visibleToInstantApps element to true. This element is available to apps running on Android 8.0 (API level 26) or higher.
  • An installed app contains an intent filter that includes CATEGORY_BROWSABLE.
  • The Instant app sends an intent using either the ACTION_SEND, ACTION_SENDTO, or ACTION_SEND_MULTIPLE action.
How to add dependencies?

To use the Google Play Instant APIs in your app, include the following declaration in your app module’s build.gradle configuration file: implementation “com.google.android.gms:play-services-instantapps:17.0.0”

Version code for Instant Experiences

The version code of your app’s Instant experience needs to be less than the version code of the installable app. This is because when users move from the instant app to the full-app installation, the Android framework considers this transition to be an app update.

Note: If a user has already installed your app on their device, that installed version will always run instead of your instant experience. This is true even if the installed app is an older version compared to your instant experience.

Updating for the Sandbox Version

Your instant app’s AndroidManifest.xml file needs to be updated to target the sandbox environment that Google Play Instant supports. You can complete this by adding the android:targetSandboxVersion attribute to your app’s <manifest> element, as shown in the following code snippet:

<manifest
  xmlns:android="http://schemas.android.com/apk/res/android"
...
android:targetSandboxVersion="2" ...>
Declare Instant-enabled app modules

You can declare that your app bundle supports instant experiences using the following method. Android Studio adds the following declaration to the module’s manifest:

<manifest ... xmlns:dist="http://schemas.android.com/apk/distribution">
    <dist:module dist:instant="true" />
    ...
</manifest>
Check whether an app is running Instant Experience

If some of your app’s logic depends on whether the user is engaged in your instant experience, call the isInstantApp() method. This method returns true if the currently running process is an instant experience.

Bubbles

Bubbles are available as a new preview feature in Android Q. With Android 11, you can pin conversations so they always appear on top of other apps and screens. Bubbles keep the conversation going — while you stay focused on whatever else you’re doing. Access the chat anytime or from anywhere without having to leave your current app. Bubbles simplify multitasking for Android users. You can simply drag conversations around or tap to open the chat screen. Bubbles enable users to multitask whilst chatting.

Bubbles feature is built into the Notification system of Android 11. It floats on top of other apps content and follows the user whatever app they might be using. Bubbles can be expanded to reveal app functionality and information and can be collapsed when not being used.

How to implement Bubbles?

Bubbles feature is created with the help of the Notification API. If you want your app’s notification to display as a bubble, you need to add some extra data to it. The expanded view of a bubble is created from an activity you choose. The activity needs to be configured to display properly as a bubble.

<activity
  android:name=”.bubbles.BubbleActivity”
  android:theme=”@style/AppTheme.NoActionBar”
  android:label=”@string/title_activity_bubble”
  android:allowEmbedded=”true”
  android:resizeableActivity=”true”
/>

The bubble must be resizable, embedded, and launchable in document mode, declare the following attributes for the activity in the manifest.

  1. The first step is to create the PendingIntent and specify the bubble activity:

// Create bubble intent
val target = Intent(context, BubbleActivity::class.java)
val bubbleIntent = PendingIntent.getActivity(context, 0, target, 0 /* flags */)

  1. The second step is to create a BubbleMetadata object via Notification.BubbleMetadata.Builder and set the target intent.

val bubbleMetadata = Notification.BubbleMetadata.Builder()
.setDesiredHeight(600)
.setIntent(bubbleIntent)
.setAutoExpandBubble(true)
.setSuppressNotification(true)
.build()

  1. The next step is to create the notification and add the BubbleMetadata by using setBubbleMetadata.

// Create notification
val chatPartner = Person.Builder()
.setName(“Chat partner”)
.setImportant(true)
.build()

val builder = Notification.Builder(context, CHANNEL_ID)
.setContentIntent(contentIntent)
.setSmallIcon(smallIcon)
.setBubbleMetadata(bubbleData)
.addPerson(chatPartner)

Note: The first time you send the notification to display as a bubble, it has to be in a notification channel with IMPORTANCE_MIN or higher.

Permissions required to activate Bubbles

When an app presents its first bubble, a permission dialog is shown that offers two choices:

  • Block all bubbles from your app: Notifications cannot be blocked, but they will never appear as bubbles.
  • Allow all bubbles from your app: All notifications sent with BubbleMetaData will appear as bubbles.

Now that you know about these two new Android features, you can build apps that utilize Instant experiences and Bubbles.

Our Offerings

  • Quality Engineering & Testing Services

    HyperAutomation represents a transformative leap in business operations, integrating cutting-edge technologies to stream...

  • Data & AI Services

    AgreeYa’s Cloud and Infrastructure service is a combination of consultation, deployment, cloud application, migration ...

  • Robotic Process Automation

    AgreeYa's RPA offering enables organizations to reimagine their business process management. We follow a platform and te...