Questions tagged [android-task]

Android task is a collection of activities that users interact with when performing a certain job. The activities are arranged in a stack (the back stack), in the order in which each activity is opened.

Android task is a collection of activities that users interact with when performing a certain job. The activities are arranged in a stack (the back stack), in the order in which each activity is opened.

A task is a cohesive unit that can move to the "background" when users begin a new task or go to the Home screen, via the Home button. While in the background, all the activities in the task are stopped, but the back stack for the task remains intact - the task has simply lost focus while another task takes place. A task can then return to the "foreground" so users can pick up where they left off.

Useful links

124 questions
3
votes
0 answers

GcmTaskService and threading

Does onRunTask run on a different thread? This is not clearly explained in the documentation here https://developers.google.com/android/reference/com/google/android/gms/gcm/GcmTaskService. Or Is there other documentation I should look at? The…
Don Box
  • 3,166
  • 3
  • 26
  • 55
3
votes
3 answers

Lollipop: Get top activity name

How to get top activity name in Lollipop? ((ActivityManager)getSystemService(Context.ACTIVITY_SERVICE)). getRunningTasks(1).get(0).topActivity is not longer available for Lollipop: * @deprecated As of {@link…
VKDev
  • 604
  • 7
  • 18
3
votes
0 answers

How to run Python3 commands in Android Studio?

I have a custom gradle task (Exec type) which is responsible for running Python3 command and this task happens before the buildProcess. When i manually fire assembleDebug command via terminal, task works find and there a successful build. But when I…
3
votes
1 answer

FLAG_ACTIVITY_NEW_TASK and FLAG_ACTIVITY_CLEAR_TASK acts weird

I've been testing the intent flags but I need to clarify something. I have two items in my navigation drawer and on click I do this, Intent intent = new Intent(this, activityClazz); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |…
Barışcan Kayaoğlu
  • 1,294
  • 3
  • 14
  • 35
3
votes
1 answer

How to clear the stack on a SingleTop SingleInstance MainActivity on Android?

I am trying to clear every single activity on the stack by startActivity method with the Intent flags: (Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY) (I have an exit button that resets and finishes all…
2
votes
1 answer

Android: closing connection when app is killed

I have an app that handles an XMPP connection. Now this connection is closed and resumed correctly when the main (and only) activity goes onStop(). Problem is, in the particular case when the user: -is using the app -open the recent apps list (eg…
jack_the_beast
  • 1,838
  • 4
  • 34
  • 67
2
votes
0 answers

Task stack being reset to root when launching from app icon with a singleTask Activity; why?

Scenario: I have MainActivity, which has s MAIN and LAUNCHER. This activity is set to have launchMode="singleTask" by required design. I navigate in some path: MainActivity -> Activity A -> Activity B, which are all added to the task…
Shan
  • 41
  • 4
2
votes
3 answers

How to delay some action in Android so that a task completes after a set Delay?

I am trying to develop an app in Android which has a few actions that need to be executed after a set period of time. Anything which I can do to fulfil this?
Utkarsh
  • 31
  • 1
  • 3
2
votes
2 answers

Android Notification click keep stack and bring app to front if need. Pass data if specific activity is on top

How can I click a notification, bring my app to the foreground if needed, and keep the stack as it was (even when the app went to the background)? I have a NotificationClickActivity that is launched when the user clicks a notification. When the…
Favolas
  • 6,963
  • 29
  • 75
  • 127
2
votes
0 answers

Going to Android Task Switcher causes Native window to be destroyed

If my NDK based app is running, and I swipe up from bottom, to get the Task Switcher, my Native Window is destroyed. Is this normal behaviour? I see this on Android9, and I could have sworn that going to the task switcher in older Android OS…
Bram
  • 7,440
  • 3
  • 52
  • 94
2
votes
0 answers

How to get the result from a call to google services?

I'm trying to get the location with the google-location services for android. I've tried to fiddle with some methods from the google api from the tasks package, but all seem to fail. More exactly, my application starts to hang. public class…
2eety
  • 89
  • 1
  • 13
2
votes
0 answers

Android 7 + - Stack #0 vs Stack #1

I wanted to resolve some multi-activity issues in android and someone pointed to me a command to analyze the currently active activities using : adb shell dumpsys activity activities From what I understand, Nougat has 2 stacks : Stack #0 and Stack…
iammrmehul
  • 730
  • 1
  • 14
  • 35
2
votes
0 answers

What "Stack" means in 'adb shell dumpsys activity'?

Running adb shell dumpsys activity activities shows the current tasks and its activities. But the tasks are grouped by "Stacks" (eg. Stack #0, Stack #1). What those Stacks means? The following result below shows an example. I've opened Play Store…
Samuel T.
  • 194
  • 3
  • 13
2
votes
1 answer

How to fix app go to background after reorder to front and back

I currently managed to allow user switch between two distinct acitivties groups (let's said 4 activity classes A/B group and X/Y group) and switch by FLAG_ACTIVITY_REORDER_TO_FRONT flag, but I noticed there are some strange behaviour: A ->(start…
2
votes
0 answers

Intent.FLAG_ACTIVITY_NEW_TASK is doing What we think it should do?

Looks like Every tutorial that we have got out there on the Web mentions that FLAG_ACTIVITY_NEW_TASK Starts a new task if the Activity we are starting is not currently running in the task.But it seems that using FLAG_ACTIVITY_NEW_TASK doesn't…
1
2
3
8 9