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
4
votes
2 answers

Android service Service crashed 2 times, stopping: ServiceRecord

I am writing and testing an android app where I need to restart app on multiple crashes. The restart code works fine, but after 2 crashes the service does not restart, and I see following message in the logs 06-13 02:31:02.098:…
4
votes
0 answers

Android: Broadcast receiver for any app launch or if any app comes to foreground

I have a service which has to monitor which application is in the foreground and based on the application do some functionality. I can get the list of foreground applications, using ActivityManager.getRunningAppProcesses(). But with this I cannot…
3
votes
2 answers

Android application process gets killed automatically after running for some time

My android application gets killed automatically after running for some time (1 hour), this is the log that gets printed to the console when the process dies. Process (PID 21659) has died, and there are other services killed before my…
3
votes
1 answer

How to get running process in Android?

As of API level 21, getRunningAppProcesses() returns the app itself. How can I get the processes running in the android ?
Mayank Raj
  • 921
  • 2
  • 12
  • 23
3
votes
1 answer

How to get Top Activity name of own App

In MainActivity I want to know the current Top Activity opened inside App. For pre-lollipop I used following ActivityManager am = (ActivityManager)this.getSystemService(Context.ACTIVITY_SERVICE); ComponentName cn =…
user1590595
  • 795
  • 2
  • 13
  • 37
3
votes
0 answers

ActivityManager unable to restart Service after killed

i have the following onCreate() on the MainActivity: public void onCreate(Bundle savedInstanceState) { Intent intent = new Intent(this, BackgroundService.class); getApplicationContext().startService(intent); } and this Service: public class…
Matt
  • 721
  • 9
  • 26
3
votes
1 answer

Android Marshmallow 6.0 , check running app in background

In Marshmallow, even if application in not in backgounnd and foreground . i am getting as "application is running". code i use is ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); …
3
votes
1 answer

How to kill chat-heads like app form other app programmatically?

I'm writing an application managing access to other applications. User can decide which app he would like to block on device, If someone start blocked app he see screen informing him about blockade. I have my own launcher and background process…
Artur Latoszewski
  • 735
  • 1
  • 10
  • 21
2
votes
0 answers

Replace getRunningServices(int) for a newer method

I have a function that is using getRunningServices(int) and is working fine, but it is deprecated. I have searched in the forum similar questions and I have found one question with exactly the same function I am using, but the answers were just…
Lechius
  • 189
  • 7
2
votes
1 answer

Android Emulator as `LowRamDevice`

There's a method ActivityManagerCompat.isLowRamDevice(), and I'm trying to figure out how to test it. I've tried the following to get it to return true, but it's always false: Create a new emulator with 128 MB of RAM (Still returns false) adb shell…
Jason
  • 13,563
  • 15
  • 74
  • 125
2
votes
1 answer

broadcast intent callback: result=CANCELLED

I noticed in Android Monitor the ActivityManager force stopping my application. On certain devices, this happens almost immediately of removing from MRL for tasks. I then run adb shell dumpsys package and noticed that indeed my process has…
Loren Rogers
  • 325
  • 3
  • 13
2
votes
1 answer

Android: getSystemService(Context.ACTIVITY_SERVICE) is not working in Service

I am getting a strange problem which I am not able to understand as the app does not give any crash log or any other message which I can follow to search the problem. I launching a service from my activity and in this service I am trying to find out…
Pagar
  • 87
  • 1
  • 12
2
votes
1 answer

ActivityManagerCompat.isLowRamDevice is useless, is always returns false

I wanted to use the helper method isLowRamDevice for my app, which streams videos. As I support devices down do API level 15, I had to use ActivityManagerCompat.isLowRamDevice(). I was really confused, that it always returned false, even if I use…
JensJensen
  • 1,017
  • 1
  • 12
  • 25
2
votes
1 answer

android detect the recent buttons click

How to detect the recent buttons click in android. If I use the, onWindowFocusChanged, It's calling if any new activity started. If I try to use ActivityManager.getRunningTasks and check the top activity's package name is the applications package…
2
votes
2 answers

How to get the reason for process start in android program?

I can see some log like this: Start proc com.**.** for activity com.**.**/com.**.**: pid=11091 uid=10146 gids={50146, 3003, 1028, 1015} by log Tag ActivityManager. So, I want to know, how can i get the activity's class name in the process
wind
  • 41
  • 3
1 2
3
8 9