How to determine the application has been installed over?
Make a download, install, remove, and the code I have written. After downloading the automatic installation can be achieved, but I do not know what to delete when executed ah. . Determine how it should have been installed, and then to delete the installation package ah? Written on the back of the installation, it will appear first delete the installation package, then the situation can not be installed. . Reply: You are your own or through the realization of the installation system installation? The former, then there is a listener class PackageInstallObserver extends IPackageInstallObserver.Stub { The latter, then you can listen to the broadcast to determine whether installing Reply:
public void install () { Intent intent = new Intent (Intent.ACTION_VIEW); intent.setDataAndType ( Uri.parse ("file :/ /" + SD_PATH + fileName), "Application / vnd.android.package-archive"); context.startActivity (intent); } Installation method. . It should be how to judge ah? Reply:
It's not a silent installation, do not judge it Reply:
You are your own or through the realization of the installation system installation? The former, then there is a listener class PackageInstallObserver extends IPackageInstallObserver.Stub { The latter, then you can listen to the broadcast to determine whether installing
public void install () { Intent intent = new Intent (Intent.ACTION_VIEW); intent.setDataAndType ( Uri.parse ("file :/ /" + SD_PATH + fileName), "Application / vnd.android.package-archive"); context.startActivity (intent); } Installation method. . It should be how to judge ah?
It's not a silent installation, do not judge it
Amount. That is also how I finished this installation, delete the installation file ah. . I tried deleting added directly behind this approach, the result will be the first to be removed to install the package. . Reply: Installation will be broadcast over
private class InstallReceiver extends BroadcastReceiver { @ Override public void onReceive (Context context, Intent intent) { / / TODO Auto-generated method stub if (intent.getAction (). equals (Intent.ACTION_PACKAGE_ADDED)) { . / / Toast.makeText (. Context, intent.getDataString () substring (8), 2000) show (); String packName = intent.getDataString () substring (8);. / / PackName program is installed package name allPackage.add (packName); for (InstallAppInfo info: installAppMap.values ()) { if (info.getPackageName (). equals (packName)) { installAppMap.remove (info.getId ()); JSONObject install = new JSONObject (); try { install.put ("package_name", packName); install.put ("result", true); } Catch (JSONException e) { Log_E ("in class InstallReceiver and get install object occur error"); } callJavaScriptMethod (installcallback, install.toString ()); break; } } } } }
Reply:
installation will be broadcast over
private class InstallReceiver extends BroadcastReceiver { @ Override public void onReceive (Context context, Intent intent) { / / TODO Auto-generated method stub if (intent.getAction (). equals (Intent.ACTION_PACKAGE_ADDED)) { . / / Toast.makeText (. Context, intent.getDataString () substring (8), 2000) show (); String packName = intent.getDataString () substring (8);. / / PackName program is installed package name allPackage.add (packName); for (InstallAppInfo info: installAppMap.values ()) { if (info.getPackageName (). equals (packName)) { installAppMap.remove (info.getId ()); JSONObject install = new JSONObject (); try { install.put ("package_name", packName); install.put ("result", true); } Catch (JSONException e) { Log_E ("in class InstallReceiver and get install object occur error"); } callJavaScriptMethod (installcallback, install.toString ()); break; } } } } }
Amount, which broadcasts did not understand ah. . Great God seek advice ah. . Reply: Can be used to install radio listeners whether application is installed, install the radio after the trigger, according to the package name, and then on your list than the next, and then delete it. Reply:
Installation will be broadcast over
private class InstallReceiver extends BroadcastReceiver { @ Override public void onReceive (Context context, Intent intent) { / / TODO Auto-generated method stub if (intent.getAction (). equals (Intent.ACTION_PACKAGE_ADDED)) { . / / Toast.makeText (. Context, intent.getDataString () substring (8), 2000) show (); String packName = intent.getDataString () substring (8);. / / PackName program is installed package name allPackage.add (packName); for (InstallAppInfo info: installAppMap.values ()) { if (info.getPackageName (). equals (packName)) { installAppMap.remove (info.getId ()); JSONObject install = new JSONObject (); try { install.put ("package_name", packName); install.put ("result", true); } Catch (JSONException e) { Log_E ("in class InstallReceiver and get install object occur error"); } callJavaScriptMethod (installcallback, install.toString ()); break; } } } } }
Amount, which broadcasts did not understand ah. . Great God seek advice ah. .
private class InstallReceiver extends BroadcastReceiver { @ Override public void onReceive (Context context, Intent intent) { / / TODO Auto-generated method stub if (intent.getAction (). equals (Intent.ACTION_PACKAGE_ADDED)) { . / / Toast.makeText (. Context, intent.getDataString () substring (8), 2000) show (); String packName = intent.getDataString () substring (8);. / / PackName program is installed package name
/ / According packName, and then compare } } } Reply: learn Reply: It s worth learning Reply: This broadcast is so well written Reply: Amount, give me a good idea, thank you. . But I am still a novice, are less likely to use radio slowly under study, and how to combine the above installation.
No comments:
Post a Comment