문제

Is there a method of the Activity lifecycle that is guaranteed to get called when my app crashes?

I put logs in all methods and crashed my app but I didn't see anything.

I couldn't find anything in the docs too.

I basically want to save changes in a database but ideally I do not want to do it in every update but rather in a method like onPause or onStop etc.

도움이 되었습니까?

해결책

None of the lifecycle methods will be called if your Activity crashes.

However, for child activities started using startActivityForResult you do get a RESULT_CANCELED code returned in onActivityResult on the parent Activity.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top