Is it possible that onPause() gets called if onResume() hasn't been called before?

蹲街弑〆低调 提交于 2020-06-17 07:57:10

问题


I register receiver in onResume() and unregister it in onPause() method. I can strange error in my Crashlytics reports:

Fatal Exception: java.lang.RuntimeException
Unable to pause activity {package-here}: java.lang.IllegalArgumentException: Receiver not registered: 

Caused by java.lang.IllegalArgumentException
Receiver not registered:

It happened 3 times (3 users) on 20k installs.

Is it possible that onPause() gets called if onResume() hasn't been called before? I thought it isn't.


回答1:


If it is Samsung device then yes, it is possible: https://issuetracker.google.com/issues/37001269#c3




回答2:


If you open and close the app too often(Multiple times in 1 second),it will happen



来源:https://stackoverflow.com/questions/50326274/is-it-possible-that-onpause-gets-called-if-onresume-hasnt-been-called-befor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!