Example #1
0
 public Device() {
   // Determine device version
   int sdk = Build.VERSION.SDK_INT;
   if (sdk < Build.VERSION_CODES.HONEYCOMB) {
     version = "2.x";
   } else {
     if (sdk > Build.VERSION_CODES.HONEYCOMB_MR2) {
       version = "4.x";
     } else {
       version = "3.x";
     }
   }
   // Determine with and height
   DisplayMetrics dm = new DisplayMetrics();
   getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
   height = dm.heightPixels;
   width = dm.widthPixels;
   density = dm.density;
   // Determine device type
   type = "phone";
   try {
     if (GeckoAppShell.isTablet()) {
       type = "tablet";
     }
   } catch (Exception e) {
     mAsserter.dumpLog("Exception in detectDevice", e);
   }
 }