Appo

Browser Fallbacks

Fallback behavior for every API when running outside a native container.

All APIs provide fallback behavior when running outside a native Appo container. This allows you to develop and test in a browser without conditional imports or mocking.

Fallback Table

FeatureMethodFallback
PushrequestPermission()Returns 'denied'
PushgetToken()Returns null
PushonMessage()Returns no-op unsubscribe
PushonResponse()Returns no-op unsubscribe
BiometricsisAvailable()Returns false
Biometricsauthenticate()Returns false
CamerarequestPermission()Returns 'denied'
CameratakePicture()Throws Error
LocationrequestPermission()Returns 'denied'
LocationgetCurrentPosition()Throws Error
Hapticsimpact()No-op
Hapticsnotification()No-op
Storageget() / set() / delete()Uses localStorage
Shareopen()Uses navigator.share if available, otherwise { success: false }
NetworkgetStatus()Returns { isConnected: navigator.onLine, type: 'unknown' }
NetworkonChange()Listens to browser online/offline events
DevicegetInfo()Returns user agent-based info with osVersion: 'web'

Environment Detection

Use isNative to conditionally execute native-only logic:

const appo = getAppo();

if (appo.isNative) {
  // Only runs inside a native Appo container
  const token = await appo.push.getToken();
} else {
  // Browser environment
  console.log('Running in browser mode');
}

Storage Behavior

Storage has a transparent fallback — it uses localStorage in the browser and native secure storage in the app. This means you can use appo.storage unconditionally:

// Works in both environments
await appo.storage.set('preference', 'dark');
const pref = await appo.storage.get('preference');

On this page