Funky android activity behavior when screen turns off?

后端 未结 2 1369
误落风尘
误落风尘 2021-02-15 12:41

I\'m seeing some interesting activity flow when android turns off the screen and locks the screen... my app goes through the regular flow, onCreate, onStart and onResume. Then,

2条回答
  •  -上瘾入骨i
    2021-02-15 13:45

    It may not be what you are seeing, but on my phone, something like this happens because sleep mode is always in one orientation, and if the app was in the other one it gets killed and recreated in the sleep orientation... rather suboptimal if you ask me.

    It sounds to me like you may not have things such as your startup sound tied to sufficiently specific causes. What happens if you rotate the phone while it's "on" ? At any rate, you should be able to detect that the screen is not on and not do (or defer) a real startup.

    If an implicit orientation change is the culprit, you can change how your application is treated with these - set things to claim your application can change on the fly instead of having to be recreated.

提交回复
热议问题