How to bring Android existing activity to front via notification

后端 未结 4 2039
醉酒成梦
醉酒成梦 2020-12-06 10:46

I have one Android application, when it runs a service, I want to show the notification on the status bar. Then the user could navigate to other application by pressing HO

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-06 11:25

    When an Activity is in the background, Android may kill the activity at any time to free resources. See the Activity documentation for complete details on the lifecycle.

    Your activity needs to be prepared to save its state in the onPause or onSaveInstanceState methods. The document referenced above has additional details on saving persistant state.

提交回复
热议问题