react-native-background-geolocation@5.0.0-beta.1
    Preparing search index...

    Interface DeviceSettings

    Device Settings API (types-only).

    Provides an API to show Android & vendor-specific Battery / Power Management settings screens that can affect performance of the Background Geolocation SDK on various devices.

    See: https://dontkillmyapp.com/

    // Is Android device ignoring battery optimizations?
    const isIgnoring = await BackgroundGeolocation.deviceSettings.isIgnoringBatteryOptimizations();
    if (!isIgnoring) {
    const req = await BackgroundGeolocation.deviceSettings.showIgnoreBatteryOptimizations();
    if (!req.seen) {
    const confirmed = await showMyConfirmDialog({ title: 'Settings request', text: 'Please disable battery optimizations' });
    if (confirmed) {
    await BackgroundGeolocation.deviceSettings.show(req);
    }
    }
    }
    interface DeviceSettings {
        isIgnoringBatteryOptimizations(): Promise<boolean>;
        showIgnoreBatteryOptimizations(): Promise<DeviceSettingsRequest>;
        showPowerManager(): Promise<DeviceSettingsRequest>;
        show(request: DeviceSettingsRequest): Promise<boolean>;
    }
    Index

    Methods

    • Returns true if device is ignoring battery optimizations for your app.

      In most cases, the SDK performs normally with battery optimizations enabled.

      Returns Promise<boolean>

    • Prepare a request to show Android’s Ignore Battery Optimizations settings screen.

      Does not immediately redirect — returns a DeviceSettingsRequest first so you can decide whether to prompt the user (eg: avoid annoying them if seen === true).

      ⚠️ On some devices/OS versions, this screen may not exist; callers should catch errors.

      Returns Promise<DeviceSettingsRequest>

    • Prepare a request to show a vendor-specific “Power Manager” screen (Huawei, Xiaomi, Vivo, etc).

      Does not immediately redirect — returns a DeviceSettingsRequest first. Not all vendors/versions implement this screen; callers should catch errors.

      Returns Promise<DeviceSettingsRequest>