原生扩展的Adobe AIR,允许与Android软件包管理器的交互。
获取的所有系统应用程序列表
得到所有用户安装的应用程序列表
打开设备上的另一个应用程序。这也支持了传递名称/值字符串属性的对象添加为演员传递到启动应用程序
从App Store通过ID安装应用程序
从设备卸载应用程序
Native extension for Adobe AIR that allows for interaction with the Android PackageManager.
PackageManagerANENative extension for Adobe AIR that allows for interaction with the Android PackageManager. It allows for the following: - Get list of all system applications
- Get list of all user installed applicaitons
- Open another application on the device. This also supports passing an object of name/value string properties to be added as extras passed to the launching application
- Install application from the app store by id
- Uninstall application from the device
Available events: - public static var ERROR_INSTALL_APP:String = "ERROR_INSTALL_APP";
- public static var ERROR_RUN_APP:String = "ERROR_RUN_APP";
- public static var ERROR_UNINSTALL_APP:String = "ERROR_UNINSTALL_APP";
- public static var GET_SYSTEM_APPS:String = "GET_SYSTEM_APPS";
- public static var GET_USER_APPS:String = "GET_USER_APPS";
- public static var SUCCESS_RUN_APP:String = "SUCCESS_RUN_APP";
- public static var SUCCESS_INSTALL_APP:String = "SUCCESS_INSTALL_APP";
- public static var SUCCESS_UNINSTALL_APP:String = "SUCCESS_UNINSTALL_APP";
复制代码 Need to set a value in your app.xml for your air app
- <extensions>
- <extensionID>com.gearsandcogs.air.extensions.PackageManager</extensionID>
- </extensions>
复制代码 Use case is pretty simple::
- public function PackageManagerService() {
- var pm:PackageManager = new PackageManager();
- pm.addEventListener(PackageManagerEvent.GET_SYSTEM_APPS, systemAppsReturned);
- pm.addEventListener(PackageManagerEvent.GET_USER_APPS, userAppsReturned);
- pm.addEventListener(PackageManagerEvent.ERROR_RUN_APP, runAppError);
- pm.getUserApps();
- pm.getSystemApps();
- pm.runApp("com.google.android.GoogleCamera");
- pm.runApp("com.google.android.GoogleCamera",<json_string>);
- pm.installApp("com.google.android.SomeApp");
- pm.uninstallApp("com.google.android.SomeApp");
- }
- private function runAppError(e:PackageManagerEvent):void {
- trace("unable to run app: " + e.param);
- }
- private function userAppsReturned(data:PackageManagerEvent):void {
- trace("got the user apps back");
- trace(data.param);
- }
- private function systemAppsReturned(data:PackageManagerEvent):void {
- trace("got the system apps back");
- trace(data.param);
- }
复制代码
相关链接:
https://github.com/jakehilton/PackageManagerANE
|