Invalidating Apps After Distribution
There comes a time after distribution that you want to invalidate the app.
Some cases for invalidation include:
- Releasing a final version, and beta version should stop working
- A specific version should no longer be used, and new one should be downloaded
- A terrible fault has been found, and current version should no longer run
Disabling Distribution
To disable a distribution of an App or a specific Build of an App, please follow the instructions for Stopping Distribution
After app distribution has been disabled, it could no longer be downloaded. However, in certain cases, you would want to programmatically detect distribution status, and notify the end-user what they need to do next.
For example:
- App detects distribution has been disabled, then present a popup message on screen and stop the process.
- App detects distribution has been disabled and opens browser to Internal App Store page.
Programmatically Detecting Distribution Status
Sauce Labs' App Distribution provides a simple API to receive the distribution status as set in the Build Settings page.
To fetch the status of a specific version, use
curl -XPOST \
"https://mobile.saucelabs.com/services/?method=testfairy.session.getDistributionStatus" \
-F token=$TESTFAIRY_APP_TOKEN \
-F platform=0 \
-F bundleIdentifier=com.saucelabs.mydemoapp.android \
-F bundleVersion=22 \
-F bundleShortVersion=2.0.1
token | TestFairy App Token |
platform | Mobile OS to query (0 for Android, 1 for iOS) |
bundleIdentifier | Bundle Identifier (iOS) or Package Name (Android) |
bundleVersion | bundleVersion (iOS) or versionCode (Android) of build to query |
bundleShortVersion | bundleShortVersion (iOS) or versionName (Android) of build to query |
App Distribution is using a Token. This is not your Sauce Labs' username and access key. The token itself is not private and can be used only to query status. It cannot be used to access any other data in your account.
Upon response, the API will return a json with status
equal to either enabled
or disabled
. For example:
{"status":"enabled"}
If a Build cannot be found on App Distribution platform, it is assumed deleted, and the result will be disabled
.
Sample Code
For reference, please visit the My Demo App sample application. A method called checkVersionIsStillSupported calls the API and will display an AlertDialog if version has expired.