If I place a breakpoint here in Xcode, all is well.
However the code I have added in App.js to handle it never is executed:
async componentWillMount() {
this._loadAssetsAsync();
let result = await Permissions.askAsync(Permissions.NOTIFICATIONS);
if (Constants.isDevice && result.status === "granted") {
console.log("Notification permissions granted.");
}
Notifications.addListener(this._handleNotification);
}
_handleNotification = ({ origin, data }) => {
console.info(
`Notification (${origin}) with data: ${JSON.stringify(data)}`
);
};
Notably, when I step through it in the Chrome debugger, it completely skips the call to Permissions.
There is no logging of granted permissions or any other error output.
It does register the listener, but the listener is never called.
When I schedule an immediate breakpoint it does invoke the native code and trigger the native breakpoint, but again never triggers the javascript handler.
Hmm, this might be an issue with the ExpoKit template project we generate. Remote notifications don’t work in ExpoKit, so we omit some of the permissions callbacks from your AppDelegate, but actually some of them might be needed for local notifications.
Try adding this in your AppDelegate and breakpointing in it:
When I trigger it from a local push registered from my native code, I don’t get any messages at all about a push notification being received, and my handler does not get invoked.
This is true even if the app is backgrounded. I have confirmed the local notification is invoking the native handler in all 3 cases.