android_lifecycle_app_note.pdf
文本预览下载声明
ANDROID LIFECYCLE FOR
APPLICATION DEVELOPERS:
GUIDELINES AND TIPS
May 2012
Developer Whitepaper
DOCUMENT CHANGE HISTORY
Document Number
Version Date Authors Description of Change
01 30 May, 2011 Lbishop Initial release
02 21 Sept, 2011 Lbishop Update for NativeActivity
03 4 march, 2012 Lbishop Update for new samples pack
04 16 May, 2012 Lbishop Update for suspend/resume with no lock screen
Android Lifecycle for application developers: Guidelines and Tips ii
TABLE OF CONTENTS
Android Lifecycle Basics in Practice 4
Top-Level Items 4
NativeActivity and native_app_glue 5
The Lifecycle Hierarchy Events 6
The non-Hierarchy Events 6
Mapping Lifecycle to Native Code 8
Additional Lifecycle Concepts and Realities 9
Being “Killable” 9
Callback-Handling AND ANR’s 9
onPause versus onStop 9
Rendering and Threading 10
User Actions and Callback Sequences 10
Sequencing Differences 10
Launching a New Application 11
Pressing the Back Button 11
Pressing the Home Button 12
Resuming a “Home’d” Application 12
Opening a Status Icon Pop-up 12
Closing a Status Icon Pop-up 13
Suspend/Resume 13
Basic Android Lifecycle Recommendations 15
All a Game Needs 16
Common Steps and when they can be done 16
Loading and Deleting Game Data 16
Initializing and Deleting EGL, Contexts, Surfaces and Rendering Resources 16
Rendering 18
Auto-pause 19
Handling Input 20
Exiting and Native Apps 20
Saving Game Progress 21
Resuming versus Restarting 21
Some Simple Mappings 21
Surprising Application Lifecycle Events an
显示全部