The deletePackage method is not available to third party apps.  To uninstall
an app you need to launch the uninstaller activity to have the user confirm
what is going on.

On Sat, Jul 4, 2009 at 10:43 AM, Roman <roman.baumgaert...@t-mobile.com>wrote:

>
> Check out the UninstallAppProgress.java source in packages/apps/
> PackageInstaller/src/com/android/packageinstaller
>
> Have a look at the method and follow the flow of deletePackage. You
> should be able to find out what exactly is called.
>
> public void initView() {
>        requestWindowFeature(Window.FEATURE_NO_TITLE);
>        setContentView(R.layout.op_progress);
>        //initialize views
>        PackageUtil.initAppSnippet(this, mAppInfo, R.id.app_snippet);
>        TextView installTextView = (TextView)findViewById
> (R.id.center_text);
>        installTextView.setText(R.string.uninstalling);
>        final ProgressBar progressBar = (ProgressBar) findViewById
> (R.id.progress_bar);
>        progressBar.setIndeterminate(true);
>        PackageDeleteObserver observer = new PackageDeleteObserver();
>        getPackageManager().deletePackage(mAppInfo.packageName,
> observer, 0);
> }
>
>
> --
> Roman Baumgaertner
> Sr. SW Engineer-OSDC
> ·T· · ·Mobile· stick together
> The views, opinions and statements in this email are those of the
> author solely in their individual capacity, and do not necessarily
> represent those of T-Mobile USA, Inc.
>
> On Jul 2, 7:54 pm, aljo <aljochim...@gmail.com> wrote:
> > I wan't to uninstall applications using my application... I can
> > retrieve the list of packages installed but I don't know how to remove
> > them... I used the PackageManager class, getInstalledApplications()
> > method... I can't find any method like removeApplication() or
> > uninstallApplication().
> >
> > the only method I saw in this class is the removePackageFromPreferred
> > (String packageName) method... It retrieves a list of preferred
> > packages.. I don't exactly know what preferred packages means or
> > somehow how to retrieve them... I tried to put a package name in the
> > method "removePackageFromPreferred (com.dev5.fivegame)" but it gives
> > an error...
> >
> > I'm kinda new to these stuffs so pardon me for my questions...
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to