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
{{ message }}
This repository has been archived by the owner on Oct 25, 2021. It is now read-only.
How to detect foreground/background mode after receiving the push notification on iOS? According to the documentation for the Android we can check if message property is empty. How to reach the same on iOS?
if(message===null||message===undefined){// Android messages received in the background don't include a message. On Android, that fact can be used to// check if the message was received in the background or foreground. For iOS the message is always present.title='Android background';message='<empty>';}
Hi there @maciejkoch! In the PushNotificationReceived callback on iOS, there's no way to distinguish between these modes.
However, there are multiple options if you want to achieve that:
You can check out this comment in the thread. It is about React Native iOS SDK but the same applies to Cordova iOS SDK.
If you want pure ionic solution, you can check out multiple Stackoverflow questions on this, for example, setting pause/resume listeners
Description
Hi,
How to detect foreground/background mode after receiving the push notification on iOS? According to the documentation for the Android we can check if message property is empty. How to reach the same on iOS?
I use Ionic 4 with this plugin: https://ionicframework.com/docs/native/app-center-push
Repro Steps
Please list the steps used to reproduce your issue.
Details
0.3.4
Android 8, Android 9
Cordova version 8.0.0
Nokia 7Plus, Huawei P10 Lite
cordova-android-firebase-gradle-release 3.0.0 "cordova-android-firebase-gradle-release"
cordova-android-play-services-gradle-release 3.0.0 "cordova-android-play-services-gradle-release"
cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-appcenter-analytics 0.3.4 "App Center Analytics for Cordova"
cordova-plugin-appcenter-push 0.3.4 "App Center Push for Cordova"
cordova-plugin-appcenter-shared 0.3.4 "App Center shared code for Cordova"
cordova-plugin-background-mode 0.7.2 "BackgroundMode"
cordova-plugin-browsertab 0.2.0 "cordova-plugin-browsertab"
cordova-plugin-camera 4.0.3 "Camera"
cordova-plugin-cocoapod-support 1.6.0 "Cordova CocoaPods Dependency Support"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-contacts 3.0.1 "Contacts"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 3.1.2 "cordova-plugin-ionic-webview"
cordova-plugin-ms-adal 0.10.1 "ADAL for Cordova"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlcipher-adapter 0.2.1 "Cordova sqlcipher adapter"
uk.co.workingedge.phonegap.plugin.launchnavigator 5.0.4 "Launch Navigator"
The text was updated successfully, but these errors were encountered: