uninstall app silently in android? -


I want to delete the device quietly. I'm trying this code, but gives an exception "neither user 10051 nor The current process is android.permission.DELETE_PACKAGES. " PackageInstallObserver extends IPackageInstallObserver.Stub {Public Zero packageInstalled (string PackageName, integer returnCode) throws remote exposure (if (installed packages have been! = Zero) {onInstalledPackaged.packageInstalled (package name , Return code);}}} Square PackageDeleteObserver extends IPackageDeleteObserver.Stub {Public Zero packageDeleted (String PackageName, integer returnCode) throws RemoteException {/ * ifInstalledPackagedInstalled (PackageName, returnCode);} * /} } Public Application Manager (Reference Reference) Exception = New PackageInstall Observers (); Observerdelete = New PackageDeleteObserver (); Pm = context.getPackageManager (); Class of

It is impossible to program quietly .

The best you can do is ask the user to delete the app in the dialog. When it presses "OK", there is a guideline on the application given on the Uninstaller application. It is still the user's choice, if he wants to complete the removal operation.

User is one way of saying that the user finishes the deleted operation, but it is neither loud nor rigid. After turning off the Uninstaller application, it will return to onActivityResult () in your activity. You can see if the app needs to be deleted or not. If it has not been deleted yet, you can return to the same dialog and ask again to delete the application. You can continue in this endless loop until you have prevented the user from deleting the app or using your main application. (I.e. you are telling the user that he can not use your app until he removes the second app.)

How to check if an app is installed :

  last string packagename = "com.company.other-app-name"; Android.content.pm.PackageManager pm = getPackageManager (); PackageInfo info = pm.getPackageInfo (package name, 0);   

If the information == blank or namedNotFix exception is thrown, the app is not installed.

How to indicate uninstaller for an app :

  Uri Uri = Uri.parse ("package: com.company .other-app-name "); Intent to intent = new intent (int. Action_deete, yuri); StartActivityForResult (intent, REQUEST_CODE_UNINSTALL_FREE_APP);    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -