activity-manager

How can I kill a remote process for my app?

浪子不回头ぞ 提交于 2020-06-25 05:59:09
问题 Our app uses this method to kill remote process; but can any other plan can be used? I need this because getRunningAppProcesses() may not work. public void killChildProcess() { ActivityManager actvityManager = (ActivityManager)this.getSystemService( Context.ACTIVITY_SERVICE ); List<RunningAppProcessInfo> procInfos = actvityManager.getRunningAppProcesses(); for(RunningAppProcessInfo procInfo : procInfos) { if (procInfo.processName != null && procInfo.processName.equals("package:remote")) {

Go back to specific activity from stack

我怕爱的太早我们不能终老 提交于 2020-01-11 04:32:11
问题 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 stack: [1] -> [2] -> [3] -> [4] -> [5] And I need go to second: so I need delete [3], [4], and [5] from stack and go to [2]. All activities is one class ContentActivity.java. How it possible to do? UPDATE: Some code how I start activities: public class

How to get the list of all non system apps in android

痴心易碎 提交于 2020-01-02 06:33:42
问题 I am developing an application, in which i want to get the list of all non system apps. Here is my code part: TextView tv = new TextView(this); this.setContentView(tv); ActivityManager actvityManager = (ActivityManager) this.getSystemService( ACTIVITY_SERVICE ); PackageManager pm = this.getPackageManager(); List<PackageInfo> list =pm.getInstalledPackages(0); for(int i=0;i<list.size();i++) { System.out.println("list"+i+" "+list.get(i)); } for(PackageInfo pi : list) { try { ApplicationInfo ai

How to get the list of all non system apps in android

坚强是说给别人听的谎言 提交于 2020-01-02 06:33:08
问题 I am developing an application, in which i want to get the list of all non system apps. Here is my code part: TextView tv = new TextView(this); this.setContentView(tv); ActivityManager actvityManager = (ActivityManager) this.getSystemService( ACTIVITY_SERVICE ); PackageManager pm = this.getPackageManager(); List<PackageInfo> list =pm.getInstalledPackages(0); for(int i=0;i<list.size();i++) { System.out.println("list"+i+" "+list.get(i)); } for(PackageInfo pi : list) { try { ApplicationInfo ai

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

夙愿已清 提交于 2019-12-30 02:08:25
问题 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) this.getSystemService(ACTIVITY_SERVICE); // get the info from the currently running task List< ActivityManager.RunningTaskInfo > taskInfo = am.getRunningTasks(1); Log.d("topActivity", "CURRENT Activity ::" + taskInfo.get(0).topActivity.getClassName());

Cannot run Android application on emulator/device - activity doesn't exist?

半世苍凉 提交于 2019-12-23 11:49:09
问题 When trying to run my application on the emulator I get an error from the activitymanager: ActivityManager: Error type 3 My activity exists, is listed in the manifest (in fact, its the MAIN launcher activity). Anyone know what this error means? 回答1: If you are running Eclipse try Projects-->Clean.. . and clean the project before running again. 回答2: i faced the same issue. I cleaned the project and removed the android:enabled=false in android manifest. This solved the issue. 回答3: Check

How to kill another user's background process?

允我心安 提交于 2019-12-22 17:53:29
问题 I'm not able to kill another user's background process using ActivityManager.killBackgroundProcesses . Code used is: ActivityManager am = (ActivityManager)getSystemService(ACTIVITY_SERVICE); for (RunningAppProcessInfo pid : am.getRunningAppProcesses()) { if (pid.processName.equals("com.example.sample")) am.killBackgroundProcesses("com.example.sample"); } Where com.example.sample is the package of the background process which I want to delete. That process is still running in the background

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

六眼飞鱼酱① 提交于 2019-12-21 03:35:06
问题 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 charm, I am iterating through the list of RunningAppProcessInfos and check for the importance. tl;dr What is the correct method to get current foreground process and prevent false postives? How is the order of the list done - the API says it is not

Android M: How can I get the current foreground activity package name(from a service)

青春壹個敷衍的年華 提交于 2019-12-19 03:23:11
问题 It is easy to get a list of running tasks from the ActivityManager service on Android L, and the current active task is returned first. But it don't work on Android M any more, the return list only contains my app task. Is there any way to settle it? My code: List<ActivityManager.RunningAppProcessInfo> runningAppProcessInfos = activityManager.getRunningAppProcesses(); for (int i = 0; i < runningAppProcessInfos.size(); i++) { ActivityManager.RunningAppProcessInfo runningAppProcessInfo =

Dealing with Samsung SPCM killer

让人想犯罪 __ 提交于 2019-12-17 23:16:04
问题 Lately we acquired a new Galaxy S6 with Android 5.1.1 and we are having some troubles with the new Samsung SPCM memory manager that comes with it. It is aggressively closing our app's background service, which even though is set to START_STICKY, it is not being restarted. Additionally, the service takes no more than 5MB of RAM, but still somehow we end up with the lowest score of the SPCM algorithm and gets chosen to be killed. This is our service: Public class IncomingService extends Service