SDK Configuration
Configure the SDK when initializing with initNorrix().
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
updateUrl | string | required | Base URL for Norrix OTA server |
checkForUpdatesOnLaunch | boolean | false | Automatically check on app start |
installUpdatesAutomatically | boolean | false | Auto-download and install updates |
allowStoreUpdateOverride | boolean | false | Apply OTA even when store update required |
promptToRestartAfterInstall | boolean | false | Show restart dialog after install |
statusCallback | function | - | Callback for sync status changes |
downloadProgressCallback | function | - | Download progress callback (0-100) |
Basic Configuration
Minimal setup with automatic updates:
import { initNorrix } from '@norrix/client-sdk';
initNorrix({
updateUrl: 'https://norrix.net',
checkForUpdatesOnLaunch: true,
installUpdatesAutomatically: true,
});Configuration Details
updateUrl (required)
Base URL for your Norrix OTA server.
updateUrl: 'https://norrix.net';The SDK constructs the check endpoint as:
{updateUrl}/api/update/check/{bundleId}?currentVersion=...checkForUpdatesOnLaunch
When true, the SDK automatically calls checkForUpdates() when constructed.
checkForUpdatesOnLaunch: true;installUpdatesAutomatically
When true, compatible updates are automatically downloaded and installed.
installUpdatesAutomatically: true;The update is activated on the next app restart.
allowStoreUpdateOverride
When the server indicates an update requires a new store binary (incompatible native changes), this option controls behavior:
false(default): Update is ignored, app continues normallytrue: Update is applied anyway (use with caution)
allowStoreUpdateOverride: true; // Not recommended for productionpromptToRestartAfterInstall
When true, shows a native dialog prompting the user to restart after an update is installed:
promptToRestartAfterInstall: true;Dialog text:
- Title: “Update Now?”
- Message: “Would you like to close the app now for the update to apply?”
- Buttons: “Yes, Close to Update Now” / “Will do later”
statusCallback
Called whenever the sync status changes:
statusCallback: (status, data) => {
console.log('Status:', status, data);
};See Sync Status Reference for all status values.
downloadProgressCallback
Called with download progress (0-100):
downloadProgressCallback: (progress) => {
console.log(`Download progress: ${progress}%`);
};Advanced Configuration
Full configuration with all callbacks:
import { initNorrix, SyncStatus } from '@norrix/client-sdk';
const norrix = initNorrix({
updateUrl: 'https://norrix.net',
checkForUpdatesOnLaunch: true,
installUpdatesAutomatically: true,
promptToRestartAfterInstall: true,
statusCallback: (status, data) => {
switch (status) {
case SyncStatus.CHECKING_FOR_UPDATE:
console.log('Checking for updates...');
break;
case SyncStatus.DOWNLOADING_PACKAGE:
console.log('Downloading update...');
break;
case SyncStatus.INSTALLING_UPDATE:
console.log('Installing update...');
break;
case SyncStatus.UPDATE_INSTALLED:
console.log(`Update ${data?.version} installed!`);
break;
case SyncStatus.UP_TO_DATE:
console.log('App is up to date');
break;
case SyncStatus.UPDATE_IGNORED:
console.log('Update skipped:', data?.compatibilityReason);
break;
case SyncStatus.ERROR:
console.error('Update error:', data?.message);
break;
}
},
downloadProgressCallback: (progress) => {
// Update UI with progress
updateProgressBar(progress);
},
});Environment-Specific Configuration
Use different URLs for different environments:
const updateUrl = __DEV__ ? 'https://dev.norrix.dev' : 'https://norrix.net';
initNorrix({
updateUrl,
checkForUpdatesOnLaunch: !__DEV__, // Skip in dev
installUpdatesAutomatically: !__DEV__,
});When to Initialize
Initialize the SDK as early as possible in your app lifecycle:
NativeScript Core
// app.ts
import { Application } from '@nativescript/core';
import { initNorrix } from '@norrix/client-sdk';
initNorrix({
updateUrl: 'https://norrix.net',
checkForUpdatesOnLaunch: true,
installUpdatesAutomatically: true,
});
Application.run({ moduleName: 'app-root' });NativeScript Angular
// main.ts
import { platformNativeScript } from '@nativescript/angular';
import { initNorrix } from '@norrix/client-sdk';
import { AppModule } from './app/app.module';
initNorrix({
updateUrl: 'https://norrix.net',
checkForUpdatesOnLaunch: true,
installUpdatesAutomatically: true,
});
platformNativeScript().bootstrapModule(AppModule);NativeScript Vue
// app.ts
import { createApp } from 'nativescript-vue';
import { initNorrix } from '@norrix/client-sdk';
import App from './App.vue';
initNorrix({
updateUrl: 'https://norrix.net',
checkForUpdatesOnLaunch: true,
installUpdatesAutomatically: true,
});
createApp(App).start();