How to use the react-native-background-timer.stop function in react-native-background-timer

To help you get started, we’ve selected a few react-native-background-timer 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 textileio / photos / App / Services / PhotosTask.js View on Github external
dispatch(Actions.imageAdded(photo, multipartData.payloadPath))
    UploadTask.uploadFile(multipartData.payloadPath, 'https://ipfs.textile.io/api/v0/add?wrap-with-directory=true', 'POST', multipartData.boundary)

    // PushNotificationIOS.presentLocalNotification({
    //   alertBody: 'uploading photo ' + multipartData.payloadPath,
    //   userInfo: {}
    // })
  }

  // PushNotificationIOS.presentLocalNotification({
  //   alertBody: 'photos task done',
  //   userInfo: {}
  // })
  console.log('photos task done')

  BackgroundTimer.stop() // This alerts the OS that we're done with our background task
}
github textileio / photos / App / SDK / index.ts View on Github external
break cancelSequence
        }
        await this.api.checkCafeMessages()
        await delay(ms / 2)
        if (cancelled) { // cancelled by event, so abort sequence
          foregroundEvent.remove() // remove our event listener
          break cancelSequence
        }
        // enter stopping sequence
        foregroundEvent.remove() // remove our event listener
        TextileEvents.stopNodeAfterDelayFinishing()
        await this.stopNode() // stop the node
        cancelled = true // be sure to exit the loop
    }

    await BackgroundTimer.stop()
    await BackgroundFetch.finish(BackgroundFetch.FETCH_RESULT_NEW_DATA)
  }
}
github MetaMask / metamask-mobile / app / components / Nav / Main / index.js View on Github external
handleAppStateChange = appState => {
		const newModeIsBackground = appState === 'background';
		// If it was in background and it's not anymore
		// we need to stop the Background timer
		if (this.backgroundMode && !newModeIsBackground) {
			BackgroundTimer.stop();
			this.pollForIncomingTransactions();
		}

		this.backgroundMode = newModeIsBackground;

		// If the app is now in background, we need to start
		// the background timer, which is less intense
		if (this.backgroundMode) {
			this.setState({ walletConnectReturnModalVisible: false });
			BackgroundTimer.runBackgroundTimer(async () => {
				await Engine.refreshTransactionHistory();
			}, AppConstants.TX_CHECK_BACKGROUND_FREQUENCY);
		}
	};
github textileio / react-native-sdk / src / Textile / index.ts View on Github external
if (cancelled) { // cancelled by event, so abort sequence
            foregroundEvent.remove() // remove our event listener
            break
          }
          // enter stopping sequence
          foregroundEvent.remove() // remove our event listener
          TextileEvents.stopNodeAfterDelayFinishing()
          await this.stopNode() // stop the node
          TextileEvents.stopNodeAfterDelayComplete()
          cancelled = true // be sure to exit the loop
      }
    } finally {
      // TODO: this might be better in a client provided callback
      await BackgroundFetch.finish(BackgroundFetch.FETCH_RESULT_NEW_DATA)
      // Tells iOS that we are done with our background task so it's okay to suspend us
      await BackgroundTimer.stop()
    }
  }
}
github thousight / react-native-draggable-switch / src / utils.ts View on Github external
export const stopSessionTimer = (isStillAuthed: boolean = true) => {
  BackgroundTimer.clearInterval(timeout)
  BackgroundTimer.stop()

  authenticated = isStillAuthed
}
github AOSSIE-Org / CarbonFootprint-Mobile / app / actions / ActivityDetectionAction.js View on Github external
function stopTimer() {
    if (Platform.OS === 'android') {
        BackgroundTimer.clearTimeout(this.intervalId);
    } else {
        BackgroundTimer.stop();
    }
}
/**