Scoped Storage Guide

Enterprise Browser 5.0

Overview

Apps running on Android 11 are subject to a set of restrictions called scoped storage. Introduced with Android 10 (API level 29), scoped storage was originally intended to provide more user control over stored files and reduce the clutter that often occurs on external storage devices over time. It limits apps that target API 29 (and later) to an app-specific device folder and to media types they create. Apps targeting API level 30 are prevented from accessing external storage and internal device folders, including /sdcard paths on Zebra devices.

The storage restrictions referenced in this guide apply only to apps running on devices with Android 11 (or later). However, apps that are modified for these restrictions are compatible with older Android versions, so Zebra recommends adopting changes for compliance with scoped storage restrictions in mixed environments and to "future-proof" apps for compatibility with Android 11 and beyond.

Enhancements delivered with Android 11 (API level 30) enforce greater protections on app and user data stored externally. Enterprise Browser 3.3 (and later) targets Android API level 30 (or later), and EB apps are subject to the following restrictions on devices running Android 11:

  • External storage is no longer accessible, including SD Card
  • Config.xml and other config files can be mass-deployed only to:
    /enterprise/device/enterprisebrowser
  • All references in existing Config.xml files to restricted storage locations must be modified to reflect the path above.
  • Additional changes are required if a Config.xml file contains references to an SD Card in the config files for one or more of EB's optional features:
  • EB JavaScript apps are no longer permitted to read from or write to any path that begins with /sdcard. If necessary, apps must be modified to access /enterprise/device/enterprisebrowser. This includes (but is not limited to) the following APIs:
    • AudioCapture
    • Barcode
    • Camera
    • Database
    • File
    • FileTransfer
    • MediaPlayer
    • Network
    • Printer
    • PrinterZebra
    • Signature
  • Substitution variables in the Config.xml (i.e., %PRIMARYDIR%, %SECONDARYDIR%) are no longer supported. Learn more.

Restriction Resolutions

Restricted Condition Resolution
If Config.xml file contains:
/sdcard/EnterpriseBrowser
Change to:
file:///enterprise/device/enterprisebrowser/
or
/sdcard/Android/data/com.zebra.mdna.enterprisebrowser

NOTE: Using adb to manually push individual Config.xml files to
/sdcard/Android/data/com.zebra.mdna.enterprisebrowser remains supported under scoped storage
.
If Config.xml file contains substitution variables:
%PRIMARYDIR%
or
%SECONDARYDIR%
Change all substitution variable references to:
%PERSISTCONFDIR%
Example:
<StartPagevalue="file://%PERSISTCONFDIR%/menu.html"name="Menu"/>
Learn more about substitution variables.
If mass-deploying Config.xml file to the path:
/sdcard/EnterpriseBrowser/
or
/sdcard/Android/data/com.zebra.mdna.enterprisebrowser
Change the path to: file:///enterprise/device/enterprisebrowser/

NOTE: Using adb to manually push individual Config.xml files to
/sdcard/Android/data/com.zebra.mdna.enterprisebrowser remains supported under scoped storage
.
If mass-deploying config files for one or more optional EB features:
• Keycode mapping
• Shortcuts
• DOM injection
• Native tabbar
• Custom CSS
• ButtonBar
• Page-based Actions
to the path:
/sdcard/EnterpriseBrowser/
or
/sdcard/Android/data/com.zebra.mdna.enterprisebrowser
Change the path to: file:///enterprise/device/enterprisebrowser/ and update path reference(s) in corresponding tag(s) in the Config.xml with:
%PERSISTCONFDIR%
Example:
<CustomDOMElements value="file://% PERSISTCONFDIR%/mytags.txt"/>
NOTE: Using adb to manually push individual Config.xml files to
/sdcard/Android/data/com.zebra.mdna.enterprisebrowser remains supported under scoped storage
.
If an EB app uses any EB API to read from or write to:
/sdcard/EnterpriseBrowser
The corresponding JavaScript must be modified to replace references to path(s) containing /sdcard with:
/enterprise/device/enterprisebrowser/
or
/sdcard/Android/data/com.zebra.mdna.enterprisebrowser
NOTE: If the use case requires an EMM client or other third-party app to access EB-created files, store the files in the /enterprise/ directory.
Example:
file:///enterprise/device/enterprisebrowser/fileName.ext
If file replication or movement is required, Zebra recommends using EB file transfer APIs in favor of the EMM client whenever possible.

Also See

Related Zebra Tools:

Secure Storage Manager | Securely share and persist data

From the Android Development Community:

Android 11 Storage Overview | Changes introduced with Android 11 and their effect on apps

Storage Use Cases and Best Practices | Help preparing apps for scoped storage

Android Storage Overview | The basics of Android data and file storage