。
document.addEventListener("deviceReady", function readyCallback() {
var isAppInForeground = true;
document.addEventListener("pause", function pauseCallback() {
isAppInForeground = false;
}, false);
document.addEventListener("resume", function resumeCallback() {
isAppInForeground = true;
}, false);
});
现在,当您收到通知检查标志isAppInForeground如下
window.FirebasePlugin.onNotificationOpen(function(notification) {
console.log(notification);
if(isAppInForeground){
// avoid the navigation
}
else{
// allow the navigation
}
}, function(error) {
console.error(error);
});
希望它会帮助你
非常感谢!这是我的问题的解决方案! –