Sometimes our applications need to invoke applications that others have already written (provided that they are already installed on the user's phone). Their application a calls their own application B, there are more methods, for example, in the activity of the invoked application B, set Intent-filter, and then use the intent call directly. After that, let's talk about how to invoke a third party application, such as Baidu Cloud disk.
Calling a Third-party application requires knowing two parameters (here you need to parse the Androidmanifest.xml file for Third-party applications, a bit of a cracked flavor):
The package name of the third party application;
The activity class name within the third party application (which can be selected according to its own needs, usually the first activity initiated).
You can then invoke the following code to start a third party application:
Copy Code code as follows:
ComponentName componentname = new ComponentName (pkg, CLS);
Intent Intent = new Intent ();
Intent.setcomponent (componentname);
StartActivity (Intent);
Note: Androidmanifest.xml file can be used: http://code.google.com/p/xml-apk-parser/
How to use:
AXMLPrinter2 can only parse binary XML files:
Copy Code code as follows:
Java-jar Axmlprinter.jar < binary XML file name >
Parse Androidmanifest.xml file:
Copy Code code as follows:
Java-jar apkparser.jar <apk file name >