2011-03-14 103 views
0

检查Android文档,这种方法不存在。但看在应用程序管理器(the built in one)的源代码,它使用:PackageManager.movePackage()在哪里?

mPm.movePackage(mAppEntry.info.packageName, mPackageMoveObserver, moveFlags); 

movePackage()方法,而looking in the source code(2.2 Froyo的,API)这样的方法是存在的,声明为public abstract。我想知道我怎样才能访问这个方法?

+0

为什么你要访问此方法?我没有看到用例,我不认为你应该能够移动软件包。这似乎是操作系统应该照顾的东西。 – 2011-03-14 09:29:54

+0

想写点东西来大量移动应用程序到SD卡。这是一个令我恼怒的问题,相当一段时间了。 – xandy 2011-03-14 15:59:37

回答

0

movePackage

公共抽象无效movePackage(字符串的packageName, android.content.pm.IPackageMoveObserver观察者, INT标志)

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