My app starts others apps (upon user request) using this simple code:
Intent LaunchApp = getPackageManager().getLaunchIntentForPackage("the.external.app.package");
startActivity( LaunchApp );
Is there a way to finish or close that app?
I have tried with ActivityManager.killBackgroundProcesses() and with android.os.Process.sendSignal(pid, android.os.Process.SIGNAL_KILL) but no success.
The idea is to do something like this: If the app connects to the car bluetooth then it starts the music player automatically. Once the bluetooth is disconnected it should close the music player.
Thanks