Questions tagged [activity-manager]

manages all of the top-level components (activities, receivers, services, content providers) running in them.

Using the Activity Manager, the Android System manages a stack of activities which are in different states (starting, running, paused, stopped, destroyed).

Actually the Activity Manager does more than manage activities. It was named that because in the very early implementations of Android all we had were activities (before we had even implemented multiple processes yet), but in the ultimate implementation the activity manager would probably be better called the "application manager" -- it decides when to start processes, and manages all of the top-level components (activities, receivers, services, content providers) running in them.

133 questions
63
votes
7 answers

How to use UsageStatsManager?

Background Google has deprecated the function "getRecentTasks" of "ActivityManager" class. Now all it does is to get the list of apps that the current app has opened. I've even written a post about it here on StackOverflow, but I noticed it's…
29
votes
5 answers

Force application to restart from first Activity (when a permission is denied)

It is known that when we deny permissions at runtime in Android 6.0 and resume the app from the recent menu, the app process is killed and the app is forcibly restarted. This is allegedly in order to prevent any security snafus: It is remarkable…
25
votes
6 answers

ActivityManager.getRunningTasks is deprecated android

I am working on push notification in android where i am using a below method to show notification, but the problem is that now ActivityManager.getRunningTasks(1); is being deprecated. From one stackoverflow question i read that: " you can use…
21
votes
5 answers

Android: UsageStatsManager not returning correct daily results

I'm attempting to query UsageStats from UsageStatsManager, with the aim of returning all app packages that were used daily and for how long. The Code: public static List getUsageStatsList(Context context){ UsageStatsManager usm =…
21
votes
7 answers

Cannot get foreground activity name in Android Lollipop 5.0 only

I use the following code to get the activity name of the foreground app in the variable foregroundTaskPackageName. It works on all OS versions between 4.1 to 4.4, but does not work in Android 5.0 Lollipop. Can anyone help with what has changed in…
user1406716
  • 9,565
  • 22
  • 96
  • 151
19
votes
1 answer

Get (real) foreground process using activityManager.getRunningAppProcesses()

I am trying to determine the currently visible application for the user. To do so, I use the activityManager.getRunningAppProcesses() method. I know that the method is not supported as off Android 5.1.1 - this is ok. In the beginning it worked like…
JacksOnF1re
  • 3,336
  • 24
  • 55
19
votes
4 answers

Go back to specific activity from stack

I'm trying to do something like file manager. And in action bar I wanna to do folder navigation like in "google drive" app. I need create method which can go to previous activity by number from end, or something like this. Example: So if I have…
facetostool
  • 723
  • 1
  • 6
  • 12
16
votes
5 answers

How to find whether activity is last activity in stack

I am opening a link in my app and once back is pressed I want to show HomePage to retain user for some more time. I have been trying to acheive this but unable to do so. I get homeLauncher activity as my top as well as baseActivity. DeepLink Tap >…
14
votes
2 answers

List of all of the activities in our application that are running on the device

How to get the list of all activities in our application that are running on the device. For example: pdf generation and email activities included. I can check for activities with the code like: ActivityManager am = (ActivityManager)…
sjain
  • 23,126
  • 28
  • 107
  • 185
12
votes
1 answer

What does "I/ActivityManager: Displayed...activity...+850ms" comprised of?

I'm trying to improve display time of my app's activity. I'm using logcat to track my activity display time. Here is an example of a logcat output: I/ActivityManager( 1097): Displayed…
HedeH
  • 2,869
  • 16
  • 25
12
votes
2 answers

clearApplicationUserData minimizes the app

I want to erase the data of my app programatically. I've found the method clearApplicationUserData. But when I run it, the app minimizes itself. That is, the app goes to background, like when it is pressed the home button. This is my code: if…
androidevil
  • 9,011
  • 14
  • 41
  • 79
11
votes
1 answer

Is process name same as package name in android?

By process I mean what we provide in android:process and by package I mean package in
Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289
10
votes
0 answers

Anybody know how to fix an Activity Manager Crash?

I have two activities both having a GoogleAPIClient which is used to login. Now what happens is when I go to the 2nd activity by means of the first activity, then I log in on the 1st activity, which is the one on screen, the app crashes. When I…
John Ernest Guadalupe
  • 6,379
  • 11
  • 38
  • 71
8
votes
4 answers

Why is launcher activity with launchMode="singleTask" always pushed to top of backstack even if another activity was on top?

My launcher activity has the launchMode attribute set to singleTask due to certain requirements.
vepzfe
  • 4,217
  • 5
  • 26
  • 46
8
votes
1 answer

isApplicationBroughtToBackground security feature misbehaves often

I am using this to implement a security feature that displays a locking screen if my app regains the focus after coming back from a different app. Now, the problem is that the security feature is sometimes shown twice. After digging around a bit I…
android developer
  • 1,253
  • 2
  • 13
  • 43
1
2 3
8 9