英文:
how to receive push notifications even when the play services are disabled on android
问题
Firebase使用Play服务推送通知,但我正在开发一个Android应用程序,要求在Play服务被禁用且手机处于省电模式时仍能接收推送通知。
我尝试过使用Pushy,但在省电模式下应用程序无法接收通知,我还尝试过使用前台服务,但效果不佳。
英文:
As you know firebase uses play services to push notifications but I am working on an android app that requires to receive push notifications even when the play services are disabled and the phone is on power saving.
I have tried using pushy but the app do not receive notifications in power saving mode, I have also tried using a foreground service but it is of no good.
答案1
得分: 2
这是不可能的,除非修改设备。单个应用程序无法在设备尝试节电时控制设备。否则,每个应用程序都会这样做,设备的电池寿命会受到影响。您必须依赖Play服务来管理通知,或者接受在节电模式下无法执行任何操作。
英文:
It's not possible without modifying the device. Individual apps do not have the ability to control the device when it's trying to save power. Otherwise, every app would do this, and the device's battery life would suffer as a result. You have to either depend on Play services to manage the notification, or accept that you can't do anything at all while power saving.
答案2
得分: -2
很抱歉,Android 设备上没有安装 Google Play 服务的情况下是无法接收 Firebase Cloud Messaging (FCM) 通知的。FCM 依赖于 Google Play 服务基础设施来向设备传递通知。
同样地,Android 设备上的省电模式会限制后台活动,这可能会阻止应用程序接收通知。
一种可能的解决方法是使用不依赖于 Google Play 服务并支持省电模式的第三方推送通知服务。一些此类服务的示例包括 OneSignal、Pusher 和 Amazon SNS。
英文:
Alright.
Unfortunately, it is not possible to receive Firebase Cloud Messaging (FCM) notifications without Google Play Services on Android devices. FCM relies on the Google Play Services infrastructure to deliver notifications to devices.
Similarly, power saving mode on Android devices restricts background activity, which can prevent apps from receiving notifications.
One possible workaround is to use a third-party push notification service that does not rely on Google Play Services and provides support for power saving mode. Some examples of such services include OneSignal, Pusher, and Amazon SNS.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论