Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
});
}
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,
})
})
})
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
}
})
}