0x0001
public PackageInfo getPackageArchiveInfo (String archiveFilePath, int flags)
Since: API Level 1
Retrieve overall information about an application package defined in a package archive file
Parameters
- archiveFilePath The path to the archive file
- flags Additional option flags. Use any combination of GET_ACTIVITIES,
GET_GIDS, GET_CONFIGURATIONS, GET_INSTRUMENTATION, GET_PERMISSIONS,
GET_PROVIDERS, GET_RECEIVERS, GET_SERVICES, GET_SIGNATURES, to modify the
data returned.
Returns
- Returns the information about the package. Returns null if the package could not be successfully parsed.
0x0002
public abstract PackageInfo getPackageInfo (String packageName, int flags)
Since: API Level 1
Retrieve overall information about an application package that is installed on the system.
Throws PackageManager.NameNotFoundException
if a package with the given name can not be found on the system.
Parameters
- packageName The full name (i.e. com.google.apps.contacts) of the desired package.
- flags Additional option flags. Use any combination of GET_ACTIVITIES, GET_GIDS, GET_CONFIGURATIONS,
GET_INSTRUMENTATION, GET_PERMISSIONS, GET_PROVIDERS, GET_RECEIVERS,
GET_SERVICES, GET_SIGNATURES, GET_UNINSTALLED_PACKAGES to modify the data returned.
Returns
- Returns a PackageInfo object containing information about the package. If flag GET_UNINSTALLED_PACKAGES is set and if the package is not found in the list of installed applications, the package information is retrieved from the list of uninstalled applications(which includes installed applications as well as applications with data directory ie applications which had been deleted with DONT_DELTE_DATA flag set).
0x0003
public abstract File getDir (String name, int mode)
Since: API Level 1
Retrieve, creating if needed, a new directory in which the application can place its own custom data files. You can use the returned File object to create and access files in this directory. Note that files created through a File object will only be accessible by your own application; you can only set the mode of the entire directory, not of individual files.
Parameters
- name Name of the directory to retrieve. This is a directory that is created as part of your application data.
- mode Operating mode. Use 0 or MODE_PRIVATE for the default operation, MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE to control permissions.
Returns
- Returns a File object for the requested directory. The directory will have been created if it does not already exist.
0x0004
public DexClassLoader (String dexPath, String dexOutputDir, String libPath, ClassLoader parent)
Since: API Level 3
Creates a DexClassLoader
that finds interpreted and native code. Interpreted classes are found in a set of DEX files contained in Jar or APK files. The path lists are separated using the character specified by the "path.separator" system property, which defaults to ":".
Parameters
- dexPath the list of jar/apk files containing classes and resources
- dexOutputDir directory where optimized DEX files should be written
- libPath the list of directories containing native libraries; may be null
- parent the parent class loader
不错的文章:
1、 http://blog.csdn.net/singwhatiwanna/article/details/22597587 关于加载apk中的类和代理实现的一种思路