有没有办法阻止 Huawei/Xiaomi 设备终止后台服务?使用 HMS 会减少这些问题吗?

Is there a way to stop Huawei/Xiaomi devices from killing background services? Does using HMS reduce these issues?

我相信人们都知道华为在关闭应用程序方面有多激进,这甚至会影响 GMS,因此来自 Firebase 的通知无法通过。我知道使用 HMS 会删除 Firebase 依赖项,但这是否会为您提供任何额外的标志以允许应用程序在后台 运行?就目前而言,我的聊天会话被终止,因为应用程序在最小化时会关闭。我知道你可以单独绕过这个,但无论如何都要为整个基地做。

对于华为设备,我觉得你可以试试这个方法: 打开 "settings->Apps->App launch->Manage manually" 然后打开 "Auto-launch"&"Secondary launch"&"Run in background".

华为设备考虑使用华为推送服务 https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/push-introduction

为确保您的应用 运行 在所有设备上都能正常运行,您可以查看这篇文章: https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201200435859940059&fid=0101187876626530001

HMS Push Kit将在这里工作。 GoogleFCM和HMS Pusk Kit的对比看文章 Comparison of Methods for Obtaining Data of Android Devices Between Google FCM and HUAWEI Push Kit

此处给出其他HMS推送套件文章供参考:

HMS Push Kit : Delineated using React Native

HMS PUSH KIT CLIENT SIDE

HMS PUSH KIT SERVER SIDE