}
/* Get a LoadedApk or ActivityThread.PackageInfo. How to do
- this varies by Android version. On Android 2.3.3 and
- earlier, there is no ``compatibilityInfo'' argument to
+ this varies by Android version. On Android 3.0 and earlier,
+ there is no ``compatibilityInfo'' argument to
getPackageInfo. */
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1)
+ try
{
method
= activityThreadClass.getMethod ("getPackageInfo",
(Context.CONTEXT_INCLUDE_CODE
| Context.CONTEXT_IGNORE_SECURITY));
}
- else
+ catch (NoSuchMethodException exception)
{
compatibilityInfoClass
= Class.forName ("android.content.res.CompatibilityInfo");