You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues and this is not a duplicate.
Environment
Platforms: So far only tested iOS,
iOS version: 13.6 and lower
Issues and Steps to Reproduce
Generate push notification
App is either minimized or terminated
User clicks on notification or opens app
getInitialNotification() returning null from promise no matter what
Expected Behavior
I want a way to be able to tell if the notification was clicked on so that I can either direct the navigation to the chat screen or otherwise just open the app normally. Right now, I can only get _onRemoteNotification to be hit, which is not that useful because I only want to navigate the user if they clicked on the notification, not i they got a notification while they were in the app. I can't find any use cases for this but regardless im not hitting the .catch and its returning null every time. There is a chance I'm using this incorrectly but there is barely any documentation so I guess I should ask when exactly is getInitialNotification supposed to be hit?
Actual Behavior
App opens if you click the notification, sometimes onRemoteNotification is hit sometimes it is not.
Function:
getInitialNotification() {
console.log('hitting function');
NotificationHub.getInitialNotification()
.then(res => {
console.warn(res);
//This returns null every time
if (res) {
//Never have made it inside this block
Alert.alert(
'Get Initial Notification Received',
'Alert message: ' + res.getMessage(),
[
{
text: 'Dismiss',
onPress: null,
},
],
);
}
})
.catch(reason => console.warn('ERROR', reason));
//Have not gotten an error
}
App.js/ componentDidMount : I attach a listener to appState because i want to get the notification whenever it is brought to foreground. Am I doing this correctly/logically?
componentDidMount = async () => {
AppState.addEventListener('change', state => {
store.dispatch({type: 'CHANGED_STATE', state});
//When state changes I update redux to handle other processes such as data fetching.
if (state === 'active') {
this.getInitialNotification();
//Calling method when brought to foreground
}
});
this.requestPermissions()
.then(x => console.warn(x))
.catch(err => console.warn(err));
};
The text was updated successfully, but these errors were encountered:
I realized this problem only occurs in debug/release builds but not distribution builds such as testflight which was very difficult for me to find out and eventually discovered by accident. After updating APNS certs to production and pushing the build to testflight, the getInitialNotification method is being hit on app cold start through a push notification. I don't know much else yet but this is what I have found so far.
Report
Environment
Issues and Steps to Reproduce
Expected Behavior
I want a way to be able to tell if the notification was clicked on so that I can either direct the navigation to the chat screen or otherwise just open the app normally. Right now, I can only get _onRemoteNotification to be hit, which is not that useful because I only want to navigate the user if they clicked on the notification, not i they got a notification while they were in the app. I can't find any use cases for this but regardless im not hitting the .catch and its returning null every time. There is a chance I'm using this incorrectly but there is barely any documentation so I guess I should ask when exactly is getInitialNotification supposed to be hit?
Actual Behavior
App opens if you click the notification, sometimes onRemoteNotification is hit sometimes it is not.
Function:
App.js/ componentDidMount : I attach a listener to appState because i want to get the notification whenever it is brought to foreground. Am I doing this correctly/logically?
The text was updated successfully, but these errors were encountered: