App persistence for Smart TV
BrowserStack preserves your Smart TV app and its state across sessions by default.
BrowserStack App Automate preserves your Smart TV app and its state across consecutive sessions on the same dedicated device. App state includes cached content, sign-in credentials, stored preferences, and any data the app writes to its local data directory. Sign in once and your app stays installed, authenticated, and configured. Uploading a new build applies as an in-place upgrade, so state carries over by default.
How app persistence works
App state is wiped only when one of the following is true:
-
browserstack.forceReinstallis set totrue. - The app is uploaded with a different bundle ID (Android TV and Apple TV only).
In all other cases, including uploading a new build with the same bundle ID, the build applies as an in-place upgrade and state is preserved.
Platform support
App persistence and browserstack.forceReinstall are available on all supported Smart TV platforms:
| Platform | Persistence by default | Reinstall supported |
|---|---|---|
| Android TV (Nvidia Shield, Amazon Fire TV) | Yes | Yes |
| Apple TV (tvOS) | Yes | Yes |
| Roku TV | Yes | Yes |
Force a clean install
If you pass capabilities inside bstack:options, set forceReinstall: true there. It is equivalent to browserstack.forceReinstall when passed outside bstack:options. The following snippet uses the bstack:options form.
App persistence is enabled by default. No additional capability is required. The snippet below is only needed when you want to force a clean install at session start.
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "<platform-name>");
capabilities.setCapability("platformVersion", "<version>");
capabilities.setCapability("deviceName", "<device-name>");
capabilities.setCapability("app", "<app-url>");
capabilities.setCapability("automationName", "<automation-name>");
HashMap<String, Object> bstackOptions = new HashMap<String, Object>();
bstackOptions.put("forceReinstall", true);
bstackOptions.put("projectName", "<project-name>");
bstackOptions.put("buildName", "<build-name>");
bstackOptions.put("sessionName", "<session-name>");
bstackOptions.put("dedicatedDevice", "true");
bstackOptions.put("deviceId", "<device-id>");
capabilities.setCapability("bstack:options", bstackOptions);
let capabilities = {
platformName: "<platform-name>",
platformVersion: "<version>",
deviceName: "<device-name>",
app: "<app-url>",
automationName: "<automation-name>",
"bstack:options": {
forceReinstall: true,
projectName: "<project-name>",
buildName: "<build-name>",
sessionName: "<session-name>",
dedicatedDevice: "true",
deviceId: "<device-id>",
},
};
desired_cap = {
'platformName': '<platform-name>',
'platformVersion': '<version>',
'deviceName': '<device-name>',
'app': '<app-url>',
'automationName': '<automation-name>',
'bstack:options': {
'forceReinstall': True,
'projectName': '<project-name>',
'buildName': '<build-name>',
'sessionName': '<session-name>',
'dedicatedDevice': 'true',
'deviceId': '<device-id>',
},
}
caps = {
"platformName" => "<platform-name>",
"platformVersion" => "<version>",
"deviceName" => "<device-name>",
"app" => "<app-url>",
"automationName" => "<automation-name>",
"bstack:options" => {
"forceReinstall" => true,
"projectName" => "<project-name>",
"buildName" => "<build-name>",
"sessionName" => "<session-name>",
"dedicatedDevice" => "true",
"deviceId" => "<device-id>",
},
}
Reinstall behavior by platform
Each Smart TV platform has its own install mechanics, which determine when app data is preserved and when it is cleared. A version bump or code change alone never clears state. The build is always applied as an in-place upgrade.
On Roku, all sideloaded builds share a single dev channel. Every build is installed by overwriting that channel in place, so BrowserStack does not compare binaries or versions. A build is identified by its app hash; a new hash triggers a channel overwrite but leaves the data partition intact, so state is preserved. browserstack.forceReinstall set to true deletes the channel before installing. It is the only way to clear app state on Roku.
| Scenario | Default | With Reinstall |
|---|---|---|
| Re-run the same build | App state preserved | App state wiped |
| Upload a new build | App state preserved | App state wiped |
Android TV tracks apps by bundle ID (applicationId / package name) and versionCode. Builds with the same bundle ID are installed as an upgrade using adb install -r, which preserves the app’s data directory. A versionCode bump is still an in-place upgrade, so state is kept. A build uploaded with a different bundle ID is treated as a new package by the OS, with no prior data.
| Scenario | Default | With Reinstall |
|---|---|---|
| Same bundle ID, same versionCode | Skip install, state preserved | State wiped |
| Same bundle ID, higher versionCode | Upgrade (adb install -r), state preserved |
State wiped |
| Same bundle ID, code change only | Skip install, state preserved | State wiped |
| Different bundle ID | State wiped (new package) | State wiped |
Apple TV tracks apps by bundle ID (CFBundleIdentifier) and version (CFBundleShortVersionString). Same bundle ID with the same version skips installation entirely, so state is kept. Same bundle ID with a different version applies an in-place upgrade via ideviceinstaller -g, so state is kept. A different bundle ID installs the app as a new package, and no prior state is available for that session.
| Scenario | Default | With re-install |
|---|---|---|
| Same bundle ID, same version | Skip install, state preserved | State wiped |
| Same bundle ID, different version | Upgrade (ideviceinstaller -g), state preserved |
State wiped |
| Different bundle ID | State wiped (new package) | State wiped |
Frequently asked questions
Do I need to change anything in my test script to get app persistence?
No. App persistence is the default on every supported Smart TV platform. Your existing sessions benefit automatically as long as browserstack.forceReinstall is not set to true, and the bundle ID is unchanged on Android TV and Apple TV.
What happens when I upload a new version of my app?
Uploading a new build applies as an in-place upgrade, so your app’s cache, sign-in credentials, and stored state are kept. State is only reset if you set browserstack.forceReinstall to true, or if you change the app’s bundle ID on Android TV or Apple TV, which installs it as a new package.
Does uploading a new build reset app state?
A version or code change alone does not reset state. The new build applies as an in-place upgrade on the device. To clear state, set browserstack.forceReinstall to true (works on all platforms), or change the bundle ID on Android TV or Apple TV to install the app as a brand-new package. On Roku, browserstack.forceReinstall is the only option.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!