简体   繁体   English

如何使用IBM Mobilefirst接收到推送通知时知道应用程序是在后台还是在前台

[英]how to know if app is in background or foreground when push notification is received using IBM Mobilefirst

I have a Android Native App which is integrated with IBM MobileFirst SDK. 我有一个与IBM MobileFirst SDK集成的Android Native App。

My requirement is I receive a Push Notification when app is in foreground I need to show a dialog in the UI. 我的要求是,当应用程序处于前台时,我会收到一个推送通知,我需要在UI中显示一个对话框。 But when App is in Background and receives a Push notification in the notification drawer of the phone and I click on it It should open the app but should not show any Dialog. 但是,当应用程序在后台并且在电话的通知抽屉中收到推式通知时,我单击它,它将打开应用程序,但不显示任何对话框。

How do I differentiate these two cases because the call back that is happening on these both cases is onMessage(String props, final String payload) ? 我如何区分这两种情况,因为在这两种情况下发生的回调都是onMessage(String props,final String payload)吗?

So I am unable tell wether the notification reached notification drawer or directly to the app. 因此,我无法确定通知是否到达通知抽屉或直接发送到应用程序。

I am using MobileFirst 7.1 我正在使用MobileFirst 7.1

You need to track your app visibility state by yourself. 您需要自己跟踪应用的可见性状态。 Easiest way to do this is to implement Application.ActivityLifecycleCallbacks and detect your Activity state. 最简单的方法是实现Application.ActivityLifecycleCallbacks并检测您的Activity状态。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 应用程序在前台时收到的推送通知与应用程序在后台时收到的推送通知不同 - Push notification received while the app is in the foreground is different from push notification received when the app is in background IBM MobileFirst:如何使应用程序接收有关任何活动的推送通知 - IBM MobileFirst: How to make app Receive push notification on any activity 离子1信号有一种方法可以知道从背景到前景打开应用程序或启动应用程序时是否有推送通知 - ionic 1 onesignal is there a way to know if there is a push notification when open app from background to foreground or launching app 应用程序处于前台时未收到推送通知 ios flutter - Push Notification not received when app is in foreground ios flutter 前台应用程序抖动时未收到 Firebase 推送通知? - Firebase Push Notification not received when flutter app in foreground? 当应用程序不在后台或前台时,无法将通知推送到通知管理器 - When the app is not in background or foreground, not able push Notification to Notification manager 如果应用程序处于前台,则不会收到sendbird推送通知 - sendbird push notification not received if app is in foreground 无论应用是后台还是前台,均未收到FCM通知 - FCM notification not received whether the app in background or foreground Firebase 在 android 中从后台删除应用程序时未收到推送通知 - Firebase push notification not received when app remove from background in android IBM Mobilefirst 7.1 PushNotifications:无法从后台到前台检索通知文本 - IBM Mobilefirst 7.1 PushNotifications: Unable to retrieve notification text from background to foreground
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM