Reputation: 2151
I see a couple threads on this, but none really speak to what I would like to do. I am trying to write an application that will deny another application the ability to connect to the internet (IE Firewall). Based on algorithms I am creating it will determine that application as being malicious. The app would be on a rooted phone. I would then like to either
I know there are several programs already out there, but I would like to code this myself :]]
With that being said could anyone point me in the right direction?
Thank you!
EDIT: So I have found this:
public static void killRunningPackage(final Context context, String packageName)
{
ActivityManager activityManager = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
activityManager.killBackgroundProcesses(packageName);
}
What argument do I pass in for a context? I looked at contexts online but I didnt really understand them
Upvotes: 3
Views: 1806
Reputation: 13541
Build Perspective
Even with a rooted phone, because this is handled by the frameworks, I highly doubt that you can achieve something like this.
Specifically unless you have the source and can compile the source of a new phone, you cannot do this.
SDK Perspective
Also another thing about this is you can't "strip" an application of its permissions BECAUSE its in the Manifest.xml which gets embedded into the .apk of an application, which is a binary and is registered with the PackageManager.
This is far beyond the scope of the SDK.
What you CAN do is kill an application if it isn't to your liking. The PackageManager would be your best option, however; that is as far as you can go.
Update
Check this out: http://android.amberfog.com/?p=98
Upvotes: 2