Skip to content

Instantly share code, notes, and snippets.

@elongl
Last active June 24, 2018 14:10
Show Gist options
  • Save elongl/2371ffbf9d234781a0941cd2745105ac to your computer and use it in GitHub Desktop.
Save elongl/2371ffbf9d234781a0941cd2745105ac to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import backgroundTask from 'react-native-background-task';
backgroundTask.define(() => {
console.log('Background Task Activated!');
backgroundTask.finish();
});
export default class App extends Component {
componentDidMount() {
backgroundTask.schedule();
backgroundTask.statusAsync().then(status => console.log(status));
// { available: true }
}
render() { return null }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment