roRegistry / roRegistrySection). GlobalTV uses it to remember credentials, the last active server, the last viewed channel, and the user’s safe-area preference. All values survive channel restarts and device reboots until the channel is uninstalled or the user clears them.
Registry section
All values are stored under a single registry section namedGlobalTV, defined by REG_SECTION in AppConstants.
Keys
Key (REG_KEY_*) | Key name | Type | Description |
|---|---|---|---|
REG_KEY_USER | username | String | Authenticated username. Written on successful login, deleted on logout or auth failure. |
REG_KEY_PASS | password | String | Authenticated password. Written alongside username, deleted at the same time. |
REG_KEY_SERVER | lastServer | String | Base URL of the last server that responded successfully to a health check. Used to prefer the same server on the next launch. |
REG_KEY_CHANNEL | lastChannelIndex | String (int) | Zero-based index of the last channel the user viewed. Restored on startup so the grid opens at the same position. |
REG_KEY_SAFE_MARGIN | uiSafeMarginPct | String (int) | User-configured safe-area margin percentage (0–10). Overrides the default from UI_SAFE_MARGIN_PCT. |
REG_KEY_SERVER_PROFILES | serverProfiles | String (JSON) | JSON-serialized array of server profile objects. Allows the user to add, edit, and remove backend servers from the Settings screen. |
RegistryManager API
RegistryManager.brs provides typed wrappers around the raw roRegistrySection calls. All reads, writes, and deletes go through these helpers.
Core read/write/delete
reg.Flush() is called after every write and delete. Without it, changes are buffered in memory and may not survive an unexpected channel exit.Credentials
Server selection
http://172.17.11.2 is expanded to http://172.17.11.2:3333.
Channel index
Safe-area margin
GTV_RegLoadSafeMarginPct() falls back to the compile-time default from UI_SAFE_MARGIN_PCT in AppConstants.
Cache clear
When credentials are cleared
Credentials are deleted from the registry in two situations:Explicit logout
Explicit logout
When the user selects Logout in the Settings screen,
GTV_RegClearCredentials() is called immediately. Both username and password keys are deleted and the registry is flushed. The app then navigates back to the onboarding screen.Auth failure
Auth failure
When a background session check or startup auth attempt returns
AUTH_REASON_CREDENTIALS or AUTH_REASON_INACTIVE, the app clears stored credentials to prevent repeated failed auth attempts on the next launch. The user is shown an appropriate error and redirected to the login screen.Server profiles
REG_KEY_SERVER_PROFILES stores a JSON array managed by ServerManager.brs. Each profile has the following shape:
GTV_LoadServerProfiles() falls back to the built-in defaults defined in GTV_DefaultServerProfiles():
FormatJson() and restored with ParseJson() via GTV_SaveServerProfiles() and GTV_LoadServerProfiles().
Privacy considerations
- Credentials (
username,password) are stored as plaintext strings scoped to theGlobalTVregistry section. They are not accessible to other Roku channels. - The registry is wiped when the channel is uninstalled from the device.
- Users can force a logout — and thus credential deletion — at any time from the Settings screen.
- No credentials are written to logs. The
IS_DEV_BUILDflag controls debug output, but credential values are never printed even in debug mode.