Open luizgallas opened 4 years ago
Yeah, job is not triggering. I have done all the required setup.
import BackgroundJob from "react-native-background-job";
const regularJobKey = "regularJobKey";
BackgroundJob.register({
jobKey: regularJobKey,
job: () => console.log(`Background Job fired!. Key = ${regularJobKey}`)
});
export default class Test extends Component {
state={
loading: false
}
componentDidMount(){
BackgroundJob.schedule({
jobKey: regularJobKey,
notificationTitle: "Notification title",
notificationText: "Notification text",
period: 15000
});
}
render(){
return(<></>);
}
}
Can you try adding a foreground service permission to the AndroidManifest.xml? https://developer.android.com/guide/components/foreground-services#request-foreground-service-permissions
@prajna-h Check period key of object min interval should be 15min
var backgroundSchedule = {
jobKey: "myJob",
exact:true,
allowWhileIdle :true,
notificationText :"test",
notificationTitle :'titel',
period:900000
}
BackgroundJob.schedule(backgroundSchedule)
.then(() => console.log("Success"))
.catch(err => console.err(err));
What am I doing wrong? This is not inside a component. I want to push a notification everytime the interval set by the user is reached.