本文介绍了ANR : Context.startForegroundService() 然后没有调用 Service.startForeground(), InvisibleToUser的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我们的应用程序中收到此 ANR.每当我调用 startForegroundService() 时,在 onCreate() 开始时,我都会通过通知将服务提升到前台.

有什么办法可以避免这种 ANR?这有助于我们获得 90% 的 ANR.

解决方案

点击以下链接查看 android 中前台服务的示例:示例

示例 2

I am getting this ANR in our app . Whenver I am calling startForegroundService() , in the start of the onCreate(), I am elevating the service to foreground with a notification .

Is there any way I can avoid this ANR ? This contributes to 90% of the ANR that we are getting .

I looked into this question but for them they are saying its causing a crash for them , while for us its an ANR

解决方案

Follow these links to see the examples of foreground services in android:Sample

Sample 2

这篇关于ANR : Context.startForegroundService() 然后没有调用 Service.startForeground(), InvisibleToUser的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 17:29