I want to kill OTHER(NOT ITSELF) foreground activity/service. I checked some methods about kill application.
ActivityManager.restartPackage(String packageName)
It was deprecated since android 2.2. So I can't use this method.
ActivityManager.killBackgroundProcesses(String packageName)
I think it only kills background activities. But I want to kill foreground services using startForeground().
Is there any method for killing OTHER foreground activity/service?
I reply myself.
I rooted my device and used NDK to use shell command.
And then using NDK, I killed some applications with this command.
su -c "am force-stop "