https://developer.android.com/preview/privacy/background-activity-starts
Workng on Android Q , launching activity from background.
Apps running on Android Q can start activities only when one or more of the following conditions are met:
"The app has an activity in the back stack of the foreground task."
Can someone explain what is "foreground task" mean here with example.
Thanks
The "foreground task" is the task that contains the Activity that is currently on visible on screen (ie: the viewable Activity).
The "foreground task" can also contain other activities, that either belong to the same app, or to different apps. All of these activities, since they are "covered" by the viewable Activity, are "in the back stack of the foreground task".
Here's a (hypothetical) example:
You launch a photo viewer app, choose a photo, edit the photo using a meme maker, then choose "send via Email" and are now in the Email app composing an Email. The back stack of the "foreground task" looks like this:
PhotoViewerMainActivity->PhotoViewerPhotoActivity->MemeMakerActivity->EmailComposerActivity
The current, top-most, viewable Activity is EmailComposerActivity, which is the one that you can see on screen. The other activities are covered by the viewable Activity.
Any code that belongs to the PhotoViewer App, the MemeMaker App or the EmailComposer app is allowed to start an Activity, based on the rules for Android Q.
If you now press the HOME button, the "foreground task" will be moved to the background and activities in it will no longer be "in the back stack of the foreground task"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With