When are you calling this?

One conceivable scenario would be if you are doing this a bit
asynchronously from your activity (e.g., AsyncTask). If the user fired
up your activity, then hustled over to uninstall it, *and* if the
uninstall process were to update the package info before terminating
your process, *and* your background work called getPackageInfo()
between the update of PackageManager and your process being
terminated, I can see you getting this error. Even assuming all the
implementation stuff works as described, though, this seems like a
low-probability event.

Beyond that, all I can think of are gremlins.

On Tue, Feb 7, 2012 at 7:43 AM, William Ferguson
<[email protected]> wrote:
> I'm received several instances of the IllegalStateException being
> thrown out in the wild.
> It's very rare and I can't reproduce it locally.
>
> How is it possible for it to occur?
> NB Context below is this case is an Activity.
>
>
> final String packageName = context.getPackageName();
> try {
>    return context.getPackageManager().getPackageInfo(packageName,
> PackageManager.GET_SIGNATURES);
> } catch (PackageManager.NameNotFoundException e) {
>    throw new IllegalStateException("Could not find the package for "
> + packageName + "!!", e);
> }
>
>
> William
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.7 Available!

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

Reply via email to