How to use the react-native-background-fetch.status function in react-native-background-fetch

To help you get started, we’ve selected a few react-native-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 BlueWallet / BlueWallet / models / notifications.js View on Github external
static backgroundFetchAuthorizationStatus() {
    BackgroundFetch.status(status => {
      switch (status) {
        case BackgroundFetch.STATUS_RESTRICTED:
          console.log('BackgroundFetch restricted');
          break;
        case BackgroundFetch.STATUS_DENIED:
          console.log('BackgroundFetch denied');
          break;
        case BackgroundFetch.STATUS_AVAILABLE:
          console.log('BackgroundFetch is enabled');
          break;
      }
    });
  }
github jamesisaac / react-native-background-task / js / index.ios.js View on Github external
return new Promise(resolve => {
      BackgroundFetch.status(status => {
        if (status === BackgroundFetch.STATUS_RESTRICTED) {
          return resolve({
            available: false,
            unavailableReason: 'restricted',
          })
        } else if (status === BackgroundFetch.STATUS_DENIED) {
          return resolve({
            available: false,
            unavailableReason: 'denied',
          })
        }

        return resolve({
          available: true,
        })
      })
github guardian / editions / projects / Mallard / src / helpers / push-download-failsafe.ts View on Github external
stopOnTerminate: false,
            startOnBoot: true,
        },
        async () => {
            await pushTracking('backgroundFetch', 'started')
            await clearAndDownloadIssue()
            await pushTracking('backgroundFetch', 'ended')
            BackgroundFetch.finish(BackgroundFetch.FETCH_RESULT_NEW_DATA)
        },
        error => {
            pushTracking('backgroundFetchError', error.toString())
        },
    )

    const ID = 'backgroundFetchStatus'
    BackgroundFetch.status(status => {
        switch (status) {
            case BackgroundFetch.STATUS_RESTRICTED:
                pushTracking(ID, 'restricted')
                break
            case BackgroundFetch.STATUS_DENIED:
                pushTracking(ID, 'denied')
                break
            case BackgroundFetch.STATUS_AVAILABLE:
                pushTracking(ID, 'enabled')
                break
        }
    })
}