Frage

i set a service that checks if a specific process is running in time intervals by using:

appsList = am.getRunningAppProcesses();

i saved its name and id with:

s = pross.processName;
i=pross.pid;

i launch the default launcher with:

Intent intent = null;
        final PackageManager pManager = context.getPackageManager();
        for (final ResolveInfo resolveInfo:pManager.queryIntentActivities(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME),pManager.MATCH_DEFAULT_ONLY ))
        {
            if(!context.getPackageName().equals(resolveInfo.activityInfo.packageName))
            {
                intent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                intent.setClassName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name);
                break;
            }
        }
        context.startActivity(intent);

than kill the process with :

mActivityManager.killBackgroundProcesses(s);

it all works fine but the problem is that its doing the whole calling the launcher and closing the process twice. it's like the process is still running the second time the service checks if its running.

any idea how to solve this?

Keine korrekte Lösung

Andere Tipps

I think we can not kill any other process. System not allow to do that without root access.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top