Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| android:start [2021/03/13 01:36] – jmerari | android:start [2021/05/12 15:21] (current) – jmerari | ||
|---|---|---|---|
| Line 11: | Line 11: | ||
| ==== Foreground Service ==== | ==== Foreground Service ==== | ||
| * Typical use case : Music Player keep playing the sound although UI not active | * Typical use case : Music Player keep playing the sound although UI not active | ||
| + | * The term " | ||
| * There are valid scenarios to promote your app to the foreground: The prerequisites for using a foreground service are that your app is executing a task that is immediate, important (must complete), is perceptible to the user (most often because it was started by the user), and must have a well defined start and finish. If a task in your app meets these criteria, then it can be promoted to the foreground until the task is complete. ... playing music, completing a purchase transaction, | * There are valid scenarios to promote your app to the foreground: The prerequisites for using a foreground service are that your app is executing a task that is immediate, important (must complete), is perceptible to the user (most often because it was started by the user), and must have a well defined start and finish. If a task in your app meets these criteria, then it can be promoted to the foreground until the task is complete. ... playing music, completing a purchase transaction, | ||
| - | * Although the term is " | ||
| * Apps that target Android 9 (API level 28) or higher and use foreground services must request the FOREGROUND_SERVICE permission. | * Apps that target Android 9 (API level 28) or higher and use foreground services must request the FOREGROUND_SERVICE permission. | ||
| * If your app targets Android 10 (API level 29) or higher and accesses location information in a foreground service, declare the location foreground service type as an attribute of your < | * If your app targets Android 10 (API level 29) or higher and accesses location information in a foreground service, declare the location foreground service type as an attribute of your < | ||
| * If the user has granted the ACCESS_BACKGROUND_LOCATION permission to your app, the service can access location all the time. Otherwise, if the user has granted the ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION permission to your app, the service has access to location only while the app is running in the foreground (also known as " | * If the user has granted the ACCESS_BACKGROUND_LOCATION permission to your app, the service can access location all the time. Otherwise, if the user has granted the ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION permission to your app, the service has access to location only while the app is running in the foreground (also known as " | ||
| - | * | + | |
| ==== Background Service ==== | ==== Background Service ==== | ||
| ==== Bound Service ==== | ==== Bound Service ==== | ||
| Line 22: | Line 22: | ||
| A bound service runs only as long as another application component is bound to it. Multiple components can bind to the service at once, but when all of them unbind, the service is destroyed. | A bound service runs only as long as another application component is bound to it. Multiple components can bind to the service at once, but when all of them unbind, the service is destroyed. | ||
| - | ==== Reference | + | |
| - | [[https:// | + | ===== Fragment Lifecycle Event Sequence ===== |
| + | - onAttach | ||
| + | - onCreate | ||
| + | - onCreateView | ||
| + | - onViewCreated | ||
| + | - onActivityCreated | ||
| + | - onViewStateRestored | ||
| + | - onStart | ||
| + | - onResume | ||
| + | - onPause | ||
| + | - onStop | ||
| + | - onDestroyView | ||
| + | - onDestroy | ||
| + | - onDetach | ||
| + | |||
| + | ===== Background Thread ===== | ||
| + | - [[https:// | ||
| + | |||
| + | ==== References ==== | ||
| + | - [[https:// | ||
| + | - [[https:// | ||
| + | - [[https:// | ||