首先,FCM 并不符合需求
FCM does not process messages if an app is "killed" or force stopped. When a user kills an app it is an indication that the user does not want the app running so that app should not run till the user explicitly starts it again.
https://github.com/firebase/quickstart-android/issues/368#issuecomment-343567506
Starting Jan 2019, FCM will not deliver messages to apps which were put into background restriction by the user
https://firebase.google.com/docs/cloud-messaging/android/receive
看上去是个无解的操作,fcm 似乎只能推消息给被电池优化干掉的 app,并且推送会拉起 app 做处理,仍然非常耗电。
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.