Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Important: await asychronous tasks when using HeadlessJS.
/* DISABLED
let location = await BackgroundGeolocation.getCurrentPosition({persist: false, samples: 1});
console.log('- current position: ', location);
// Required: Signal to native code that your task is complete.
// If you don't do this, your app could be terminated and/or assigned
// battery-blame for consuming too much time in background.
*/
console.log('[BackgroundFetch HeadlessTask] finished');
BackgroundFetch.finish();
}
// Register your BackgroundFetch HeadlessTask
BackgroundFetch.registerHeadlessTask(BackgroundFetchHeadlessTask);
import { AppRegistry, YellowBox } from 'react-native';
import BackgroundFetch from 'react-native-background-fetch';
import App from './src/App';
import StorybookUI from './storybook';
import { task as BackgroundTask } from './src/lib/background-task';
YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated', 'Module RCTImageLoader']);
const STORYBOOK = false;
AppRegistry.registerComponent('now', () => (__DEV__ && STORYBOOK ? StorybookUI : App));
BackgroundFetch.registerHeadlessTask(BackgroundTask);