简体   繁体   中英

How to handle case when app is resumed after push notification was received

I'm using Firebase messaging for push notifications in my Android app. It's well known that onMessageReceived is not called when app is in background and the message includes 'body' and 'title'

This is an issue because, when app is resumed by user (simply bringing the app in foreground from task list), I can't figure out how to know that it's time for the app to refresh its data.

I could always have the app try to get data when comes into foreground, but ideally I wanted to rely on push notifications.

What is the best practice to refresh the data?

This is incorrect:

It's well known that onMessageReceived is not called when app is in background.

You can receive push notifications when your app is in background, even when your application is closed.

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