简体   繁体   English

离子:背景模式在 Android 12 和 API 级别 31 中不起作用

[英]Ionic: Background mode does not work in Android 12 with API level 31

I have an Ionic 5 app with Audio player which allows user's to play audio even if the app is in background using Ionic Background mode plugin .我有一个带音频播放器的 Ionic 5 应用程序,它允许用户播放音频,即使应用程序在后台使用Ionic Background mode plugin

Above requirement works fine in API level 30. But after using API level 31, Ionic Background mode plugin doesn't work in Android 12.以上要求在 API 30 级工作正常。但是在使用 API 31 级后,Ionic Background 模式插件在 Android 12 中不起作用。

Can any one please suggest me to solve this issue.任何人都可以建议我解决这个问题。

Since background mode is not working for Android 12 with API level 31 for now, I have solved this issue by using powerOptimization.RequestOptimizations() before enabling Background mode.由于后台模式目前不适用于 Android 12 和 API 级别 31,我在启用后台模式之前使用powerOptimization.RequestOptimizations()解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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