Users often start a task on one device and want to continue it on another. They might begin reading an article on a phone and continue on a tablet, start writing a document while travelling, or open a shopping cart on one device and complete the purchase on another.
Traditionally, developers have implemented these experiences using deep links, cloud synchronization, account-based state management, and custom device discovery. These approaches work, but they require additional development and do not always provide a consistent system-level experience.
Android 17 introduces Continue On, a cross-device continuity feature that allows users to move an active app experience from one Android device to another.
Developers can enable Handoff for individual activities, provide the information required to restore the current application state, and optionally configure a web fallback when the native application is unavailable on the receiving device.
In this article, you will learn how Android 17 Handoff works, how to enable it in Kotlin, how to transfer application state, and how to restore that state on another Android device.
What Is Continue On in Android 17?
Continue On is a cross-device feature introduced in Android 17 (API level 37).
It allows users to start an application activity on one Android device and continue the same experience on another supported device.
For example, consider a user reading an article on an Android phone. When the user moves to an Android tablet, the system can display a suggestion to continue using the same application. Selecting that suggestion opens the corresponding activity and restores the relevant article and reading position.
Android handles the background device coordination and presents available activities through system surfaces such as the launcher and taskbar.
Developers are responsible for providing the information needed to recreate the application experience.
Important Handoff Concepts
There are three important concepts in Continue On:
Concept | Description |
|---|
Sending device | The Android device where the user originally opened the application |
Receiving device | The Android device where the user wants to continue the activity |
Handoff | The process of transferring the application activity and its relevant state |
Continue On is designed to work in both directions. At launch, the documented experience focuses on transitions from mobile devices to tablets.
It is important to understand that Handoff does not copy an entire running application process to another device. Instead, Android launches the designated activity on the receiving device and provides the data required to recreate the experience.
How Android 17 Handoff Works
Continue On manages the system-level discovery and handoff process.
The application provides two important pieces of information:
Which activity should open on the receiving device.
Which application state is required to restore the user's experience.
The general workflow looks like this:
Sending Android Device
|
v
User Opens an Application
|
v
Handoff Enabled for Activity
|
v
System Requests Handoff Data
|
v
Application Returns HandoffActivityData
|
v
Continue On Surfaces the Activity
|
v
User Selects the Receiving Device Suggestion
|
v
Receiving Device Launches the Activity
|
v
Application Restores the Previous State
Android manages device discovery and the system handoff experience. Developers do not need to implement their own nearby-device discovery mechanism for this feature.
Understanding the Android 17 Handoff APIs
Android 17 introduces several APIs and classes for implementing Continue On.
API or Class | Purpose |
|---|
setHandoffEnabled() | Enables or disables Handoff for an Activity |
isHandoffEnabled() | Checks whether Handoff is enabled |
onHandoffActivityDataRequested() | Provides the data required to recreate an Activity |
HandoffActivityData | Represents the activity and state information transferred between devices |
HandoffActivityDataRequestInfo | Provides information about why the system requested handoff data |
HandoffActivityParams | Configures additional Handoff behavior |
HandoffActivityData.Builder | Creates a HandoffActivityData object |
These APIs are available starting with API level 37.
Handoff is disabled by default, so developers must explicitly enable it for each activity that supports cross-device continuation.
Setting Up an Android Project
To use the Android 17 Handoff APIs, configure the project to compile against API level 37.
Update the module-level build.gradle.kts file:
android {
namespace = "com.example.handoff"
compileSdk = 37
defaultConfig {
applicationId = "com.example.handoff"
minSdk = 26
targetSdk = 37
}
}
The minimum SDK value above is only an example. Choose a minimum version based on the application's actual device-support requirements.
No separate Handoff library dependency is required for the platform APIs demonstrated in this article.
The examples use Kotlin and the Android framework classes available in Android 17.
Enabling Handoff for an Activity
Handoff support is configured separately for each Activity.
For example, suppose an application contains an ArticleActivity that displays an article. The developer wants users to continue reading that article on another device.
The first step is to enable Handoff when the activity is ready to participate.
import android.app.Activity
import android.os.Build
import android.os.Bundle
class ArticleActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_article)
if (Build.VERSION.SDK_INT >= 37) {
setHandoffEnabled(true, null)
}
}
}
The setHandoffEnabled() method accepts two parameters:
Passing null uses the default Handoff configuration.
Only enable Handoff when the activity has enough information to provide a valid restoration state.
Once Handoff is enabled, the system can request handoff data while the activity is active or when it moves into the background.
Providing Activity Data for Handoff
Enabling Handoff is only the first step.
The application must also implement onHandoffActivityDataRequested().
Android calls this method when it needs information about how to recreate the activity on another device.
The method returns a HandoffActivityData object containing the destination activity and optional state information.
For example, an article-reading application might need to transfer:
These values allow the receiving device to restore the user's previous experience.
Implementing onHandoffActivityDataRequested()
The following example demonstrates how to provide the required information.
import android.app.Activity
import android.app.HandoffActivityData
import android.app.HandoffActivityDataRequestInfo
import android.content.ComponentName
import android.os.PersistableBundle
class ArticleActivity : Activity() {
private var articleId: String = "article-101"
private var scrollPosition: Int = 0
override fun onHandoffActivityDataRequested(
requestInfo: HandoffActivityDataRequestInfo
): HandoffActivityData {
val extras = PersistableBundle().apply {
putString("article_id", articleId)
putInt("scroll_position", scrollPosition)
}
return HandoffActivityData.Builder(
ComponentName(this, ArticleActivity::class.java)
)
.setExtras(extras)
.build()
}
}
The HandoffActivityData.Builder accepts the ComponentName of the activity that should launch on the receiving device.
The setExtras() method adds the information required to restore the activity.
The extras use PersistableBundle, which supports persistable data types. The total extras size must be less than 50 KB.
Do not place complete application objects, large documents, device-specific file paths, or sensitive information inside this bundle.
For larger application data, transfer a small identifier and retrieve the actual content from your backend.
Understanding HandoffActivityDataRequestInfo
The onHandoffActivityDataRequested() method receives a HandoffActivityDataRequestInfo object.
This object helps determine why Android requested the handoff data.
The most important method is isActiveRequest().
It returns:
Value | Meaning |
|---|
true | The activity is in the foreground and the user has requested a handoff |
false | The activity is in the background and Android is requesting data to cache for a possible future handoff |
This distinction is useful when implementing application behavior around Handoff.
For example, an application may want to show a small message when the user actively requests a handoff.
However, do not perform slow operations synchronously inside onHandoffActivityDataRequested(). The method should return the handoff data as quickly as possible.
Any optional UI updates or analytics work should be scheduled asynchronously.
Restoring Application State on the Receiving Device
The receiving device launches the activity specified in HandoffActivityData.
The application must read the transferred extras and restore the appropriate state.
For example, the ArticleActivity can retrieve the article identifier and scroll position from the launch Intent.
class ArticleActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_article)
val articleId = intent.getStringExtra("article_id")
val scrollPosition = intent.getIntExtra(
"scroll_position",
0
)
if (articleId != null) {
loadArticle(articleId, scrollPosition)
}
}
private fun loadArticle(
articleId: String,
scrollPosition: Int
) {
// Retrieve article data.
// Display the article.
// Restore the reading position.
}
}
The loadArticle() method represents application-specific logic. A real application should retrieve the article from its local database or backend and restore the scroll position after the content has been loaded.
If the activity uses a launch mode that allows an existing instance to receive a new Intent, also handle onNewIntent().
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
setIntent(intent)
val articleId = intent.getStringExtra("article_id")
val scrollPosition = intent.getIntExtra(
"scroll_position",
0
)
if (articleId != null) {
loadArticle(articleId, scrollPosition)
}
}
This ensures the application can process handoff data whether Android creates a new activity instance or delivers the Intent to an existing one.
Supporting Handoff When the App Is Not Installed
One useful feature of Continue On is its support for web fallback.
Suppose a user starts reading an article in an Android application, but the receiving tablet does not have that application installed.
Instead of presenting an unsuccessful handoff, developers can configure a fallback URL.
Android can then open the corresponding web experience in the default browser.
Step 1: Configure HandoffActivityParams
Use HandoffActivityParams.Builder to allow Handoff even when the application package is not installed on the receiving device.
import android.app.HandoffActivityParams
val handoffParams = HandoffActivityParams.Builder()
.setAllowHandoffWithoutPackageInstalled(true)
.build()
Step 2: Enable Handoff With the Configuration
if (Build.VERSION.SDK_INT >= 37) {
setHandoffEnabled(true, handoffParams)
}
Step 3: Add a Fallback URI
Update the handoff data builder to include a fallback URL.
import android.net.Uri
val fallbackUri = Uri.parse(
"https://example.com/articles/article-101"
)
val handoffData = HandoffActivityData.Builder(
ComponentName(this, ArticleActivity::class.java)
)
.setExtras(extras)
.setFallbackUri(fallbackUri)
.build()
If the native application cannot be launched on the receiving device, Android can open the fallback URI in the user's default browser.
The fallback page should identify the same content and provide a useful continuation experience.
Direct-to-Web Handoff
An application can also choose to hand off directly to a web experience instead of prioritizing the native application.
val webHandoffData =
HandoffActivityData.createWebHandoff(
Uri.parse(
"https://example.com/continue/article-101"
)
)
This approach is useful when the web application provides a better experience on the receiving device.
For example, a document editor might prefer opening its web interface on a larger screen.
Choosing the Correct State to Transfer
One of the most important implementation decisions is determining which application state should be transferred.
Not every value from the sending device belongs in the handoff bundle.
For example, an application should not transfer an entire database record or an authentication token. Instead, transfer the minimum information needed to identify the user's current task.
Consider an application that displays an online course.
A suitable handoff bundle might contain:
val extras = PersistableBundle().apply {
putString("course_id", "course-202")
putString("lesson_id", "lesson-05")
putInt("video_position", 420)
putBoolean("captions_enabled", true)
}
The receiving device can use these values to retrieve the course and continue playback from the appropriate position.
A practical state-transfer strategy looks like this:
Application state | Recommended approach |
|---|
Content identifier | Transfer through PersistableBundle |
Scroll position | Transfer as an integer |
Selected tab | Transfer as a simple string or integer |
Playback position | Transfer as a timestamp |
Large documents | Retrieve from backend or synchronized storage |
Authentication credentials | Do not transfer |
Device-specific file paths | Do not transfer |
Temporary UI objects | Recreate on the receiving device |
This approach keeps the handoff payload small and avoids transferring information that is specific to the sending device.
Handling Handoff in a Production Application
A production application should not depend entirely on the values stored in the handoff bundle.
The application should have a reliable state-restoration strategy.
For example, consider a document application with cloud synchronization.
The sending device transfers a document identifier and the current editing position. The receiving device uses the identifier to retrieve the latest document version from the backend.
The restoration process can follow these steps:
Receive the handoff Intent.
Validate the transferred document identifier.
Confirm that the user is authenticated on the receiving device.
Retrieve the document from the backend.
Restore the editor position.
Display the document to the user.
If the document is unavailable or the user no longer has access, show an appropriate message instead of opening an incomplete screen.
For applications that support offline usage, maintain a local synchronized copy and use it when the network is unavailable.
Testing Continue On in Android 17
Testing Handoff requires more than launching an application on a single emulator.
You need two eligible Android devices to test the complete cross-device experience.
The official Android setup guidance describes a supported test environment involving an Android phone and an Android tablet.
Step 1: Prepare Two Devices
Use two eligible devices running Android 17.
For the documented beta testing setup, both devices should:
Be enrolled in the Android Beta for Pixel program.
Use the same Google account.
Be enrolled in the Cross-Device Services public beta.
Have the required Google system services beta installed.
Availability and device eligibility may change as Android releases progress.
Step 2: Install the Application
Install the same application version on both devices for native app-to-app testing.
Ensure that the receiving device can launch the activity specified in HandoffActivityData.
Step 3: Enable Handoff
Open the supported activity on the sending device and call setHandoffEnabled() when the activity is ready.
Step 4: Check the Receiving Device
Open the launcher or taskbar on the receiving device.
When the system surfaces the supported activity, select the suggestion to continue.
Step 5: Verify State Restoration
Confirm that the receiving device opens the correct content and restores the expected application state.
For example, verify that an article opens at the correct reading position or a document opens at the correct editing location.
Step 6: Test Web Fallback
Remove the application from the receiving device or use a suitable test configuration where it is not installed.
Verify that the configured fallback URL opens the correct web experience.
Common Mistakes When Implementing Handoff
Enabling Handoff Too Early
Once Handoff is enabled, the activity can become eligible for handoff.
If the application has not initialized the state required for restoration, it may provide incomplete data.
Enable Handoff only when the activity is ready.
Not Implementing onHandoffActivityDataRequested()
Enabling Handoff does not automatically provide application state.
The activity must implement onHandoffActivityDataRequested() and return a valid, non-null HandoffActivityData object.
Transferring Too Much Data
Handoff extras must remain below 50 KB.
Avoid transferring large objects, complete documents, images, or unnecessary application state.
Use identifiers and retrieve larger data from the backend.
Including Sensitive Information
Handoff data is transferred between devices.
Never include passwords, access tokens, personal information, or other sensitive credentials in the PersistableBundle.
Use the application's normal authentication and authorization mechanisms on the receiving device.
Ignoring the Receiving Device's Layout
A phone and tablet have different screen sizes and interaction patterns.
Restoring the same state does not mean displaying an identical layout.
Use responsive layouts and adapt the experience to the receiving device.
Assuming Every Device Supports Handoff
Continue On requires compatible Android devices and system services.
Do not make Handoff the only way users can continue their work.
Provide normal application navigation and cloud synchronization as alternatives.
Android Handoff vs Traditional Deep Links
Developers have used deep links for years to open specific application screens.
However, Continue On provides a system-level experience designed specifically for cross-device continuity.
Feature | Traditional Deep Links | Android 17 Continue On |
|---|
Primary purpose | Open a specific application screen | Continue an activity on another device |
Device discovery | Requires a separate mechanism | Managed by the system |
State transfer | Usually encoded in a URL or retrieved separately | Uses HandoffActivityData |
System suggestions | Not provided automatically | Supported through system surfaces |
Native app support | Supported | Supported |
Web fallback | Can be implemented | Supported through fallback URI |
Application integration | Intent filters and links | Activity-level Handoff APIs |
Deep links remain useful for sharing content and navigating between applications.
Continue On is a better fit when the goal is to resume an active user journey on another supported Android device.
Both approaches can work together. For example, a Handoff fallback URL can use the same web routing infrastructure as an application's existing deep links.
Advantages and Limitations of Android 17 Handoff
Advantages | Limitations |
|---|
Provides system-level cross-device continuity | Requires Android 17 or later |
Reduces the need for custom device discovery | Availability depends on supported devices and system services |
Supports native app-to-app transitions | Developers must implement state restoration |
Supports web fallback | Requires a suitable web experience |
Works with activity-specific state | Handoff payload is limited to less than 50 KB |
Supports different receiving experiences | Developers must adapt layouts for different screen sizes |
Best Practices for Cross-Device Handoff
Transfer Only Essential State
Keep the handoff bundle small. Transfer identifiers and lightweight UI state rather than complete application data.
Use Backend Synchronization
For applications with large or frequently updated data, use a backend or synchronized storage service.
The receiving device should retrieve the latest authorized data instead of relying entirely on a snapshot from the sending device.
Keep the Restoration Process Idempotent
The receiving activity should be able to restore the same state safely if it is launched more than once.
Avoid performing duplicate purchases, payments, submissions, or other irreversible operations during state restoration.
Validate Transferred Values
Treat transferred values as input.
Validate identifiers, check user permissions, and handle missing or outdated information before displaying content.
Provide a Web Fallback
If the application has a useful web experience, configure a fallback URL for users whose receiving device does not have the native application installed.
Adapt the UI to the Receiving Device
A tablet may offer more space than a phone.
Use responsive layouts to make the continued experience feel natural rather than simply stretching the original screen.
Preserve Existing Navigation
Handoff should complement existing navigation and synchronization features.
Users should still be able to find their content through normal application navigation when Handoff is unavailable.
Conclusion
Android 17 Continue On introduces a system-level approach to cross-device application continuity.
With the Handoff APIs, developers can enable individual activities, provide the information needed to recreate an application experience, and configure native or web-based destinations on receiving devices.
The most important implementation work is not simply enabling Handoff. It is deciding which state to transfer, validating that state on the receiving device, and restoring the user's experience safely.
For production applications, combine Handoff with backend synchronization, secure authentication, responsive layouts, and reliable state restoration. This creates a more consistent experience when users move between Android phones and tablets.
Join the conversation! Your thoughts help the community grow.