2011-03-14 101 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