检查 Android 文档,这种方法不存在。但是查看它使用的应用程序管理器(内置)的源代码:
mPm.movePackage(mAppEntry.info.packageName, mPackageMoveObserver, moveFlags);
该movePackage()
方法,在查看源代码(对于 2.2 Froyo,API)时,该方法存在并声明为public abstract
. 我想知道如何访问此方法?
移动包
public abstract void movePackage(String packageName, android.content.pm.IPackageMoveObserver 观察者, int flags)
Attempts to move package resources from internal to external media or vice versa. Since this may take a little while, the result will be posted back to the given observer. This call may fail if the calling context lacks the Manifest.permission.MOVE_PACKAGE permission, if the named package cannot be found, or if the named package is a "system package".
Parameters:
packageName - The name of the package to delete
observer - An observer callback to get notified when the package move is complete. android.content.pm.IPackageMoveObserver#packageMoved(boolean) will be called when that happens. observer may be null to indicate that no callback is desired.
flags - To indicate install location MOVE_INTERNAL or MOVE_EXTERNAL_MEDIA