/** * Constructor * * @author Ian Copland */ public CoreNativeInterface() throws NameNotFoundException { init(); m_packageInfo = CSApplication.get() .getAppContext() .getPackageManager() .getPackageInfo( CSApplication.get().getActivityContext().getPackageName(), PackageManager.GET_ACTIVITIES); }
/** * @author Ian Copland * @return Application version name as specified by the manifest */ public String getApplicationVersionName() { try { return CSApplication.get() .getActivityContext() .getPackageManager() .getPackageInfo(CSApplication.get().getActivityContext().getPackageName(), 0) .versionName; } catch (NameNotFoundException e) { return ""; } }
/** * @author Ian Copland * @return Application name as specified by the project */ public String getApplicationName() { if (m_packageInfo.applicationInfo != null) { return CSApplication.get() .getActivityContext() .getPackageManager() .getApplicationLabel(m_packageInfo.applicationInfo) .toString(); } else { return "ApplicationInfoWrong"; } }
/** * Terminate the activity and the app * * @author Ian Copland */ public void forceQuit() { CSApplication.get().quit(); }
/** * @author S Downie * @param Max FPS to limit device to */ public void setPreferredFPS(int in_maxFPS) { CSApplication.get().setPreferredFPS(in_maxFPS); }
/** * @author Ian Copland * @return Density of screen in dpi */ public float getScreenDensity() { DisplayMetrics metrics = new DisplayMetrics(); CSApplication.get().getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics); return metrics.density; }
/** * @author Ian Copland * @return Screen height in pixels */ @SuppressWarnings("deprecation") public int getScreenHeight() { return CSApplication.get().getActivity().getWindowManager().getDefaultDisplay().getHeight(); }
/** * @author Ian Copland * @return Application package name */ public String getPackageName() { return CSApplication.get().getActivityContext().getPackageName(); }
/** * @author Ian Copland * @return The activity. */ public Activity getActivity() { return CSApplication.get().getActivity(); }