How to check if push is currently disabled on OneSignal React Native SDK?

307 Views Asked by At

OneSignal has a OneSignal.disablePush(boolean) method to toggle push notifications globally in app. How can I read the current value of it so that I can sync it with the app state?

In other words, I'm looking for a method like OneSignal.isPushDisabled() : boolean.

1

There are 1 best solutions below

0
Simon Van Blerk On

The OneSignal React Native SDK includes the method getDeviceState which includes the isPushDisabled key in the response.

OneSignal.getDeviceState().then(deviceState => console.log(deviceState.isPushDisabled));