简体   繁体   中英

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.

My requirement is I receive a Push Notification when app is in foreground I need to show a dialog in the 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) ?

So I am unable tell wether the notification reached notification drawer or directly to the app.

I am using 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM