How to use the expo-background-fetch.registerTaskAsync function in expo-background-fetch

To help you get started, we’ve selected a few expo-background-fetch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github expo / expo / apps / native-component-list / src / screens / BackgroundFetchScreen.tsx View on Github external
toggle = async () => {
    if (this.state.isRegistered) {
      await BackgroundFetch.unregisterTaskAsync(BACKGROUND_FETCH_TASK);
    } else {
      await BackgroundFetch.registerTaskAsync(BACKGROUND_FETCH_TASK, {
        minimumInterval: 60, // 1 minute
        stopOnTerminate: false,
        startOnBoot: true,
      });
    }
    this.setState({ isRegistered: !this.state.isRegistered });
  }

expo-background-fetch

Expo universal module for BackgroundFetch API

MIT
Latest version published 1 month ago

Package Health Score

92 / 100
Full package analysis