A method that calls a third party application within an Android application

  • 2020-05-24 06:06:44
  • OfStack

Sometimes we need to call an app that someone else has already written (if it's already installed on the user's phone). For example, within the Activity of the called B application, set Intent-filter, and then use Intent directly. These later talk, this talk first talk about how to call the third party application, such as: baidu cloud disk.
Two parameters are required to call the 3rd party application (the AndroidManifest.xml file of the 3rd party application needs to be parsed first, which is a bit like cracking) :
The package name applied by the third party;
The name of Activity class in the third application (you can select the first Activity as you like).
The third party application can then be started by calling the following code:


ComponentName componentName = new ComponentName(pkg, cls);  
Intent intent = new Intent();  
intent.setComponent(componentName);  
startActivity(intent);  

Note: after write AndroidManifest) xml file can be used: http: / / code google. com p/xml - apk - parser /
Usage:
AXMLPrinter2 can only parse xml files in base 2:


java -jar AXMLPrinter.jar <2 Into the system xml The file name >  

Parse AndroidManifest.xml file:


java -jar APKParser.jar <apk The file name >  


Related articles: