(final Context context)
| 393 | } |
| 394 | |
| 395 | public static int getAppVersionCode(final Context context) { |
| 396 | final PackageManager pm = context.getPackageManager(); |
| 397 | if (pm != null) { |
| 398 | try { |
| 399 | PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0); |
| 400 | return pi.versionCode; |
| 401 | } catch (PackageManager.NameNotFoundException e) { |
| 402 | // That should not happen |
| 403 | } catch (RuntimeException e) { |
| 404 | // To catch RuntimeException("Package manager has died") that can occur |
| 405 | // on some version of Android, when the remote PackageManager is |
| 406 | // unavailable. I suspect this sometimes occurs when the App is being reinstalled. |
| 407 | } |
| 408 | } |
| 409 | return 0; |
| 410 | } |
| 411 | |
| 412 | @SuppressLint("CatchGeneralException") |
| 413 | public static boolean is64Bit() { |
no outgoing calls
no test coverage detected