List of usage examples for android.content Context UI_MODE_SERVICE
String UI_MODE_SERVICE
To view the source code for android.content Context UI_MODE_SERVICE.
Click Source Link
From source file:org.uoyabause.android.tv.GameSelectFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); //Bundle bundle = data.getExtras(); switch (requestCode) { case SETTING_ACTIVITY: if (resultCode == GAMELIST_NEED_TO_UPDATED) { refresh_level = 3;/*from w w w . jav a 2 s . c o m*/ if (checkStoragePermission() == 0) { updateGameList(); } } this.updateBackGraound(); break; case YABAUSE_ACTIVITY: SharedPreferences prefs = getActivity().getSharedPreferences("private", Context.MODE_PRIVATE); Boolean hasDonated = prefs.getBoolean("donated", false); if (hasDonated == false) { double rn = Math.random(); if (rn <= 0.5) { UiModeManager uiModeManager = (UiModeManager) getActivity() .getSystemService(Context.UI_MODE_SERVICE); if (uiModeManager.getCurrentModeType() != Configuration.UI_MODE_TYPE_TELEVISION) { if (mInterstitialAd.isLoaded()) { mInterstitialAd.show(); } } } else if (rn > 0.5) { Intent intent = new Intent(getActivity(), DonateActivity.class); startActivity(intent); } } break; default: break; } }
From source file:com.vuze.android.remote.AndroidUtils.java
public static boolean isTV() { if (isTV == null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { Context context = VuzeRemoteApp.getContext(); UiModeManager uiModeManager = (UiModeManager) context.getSystemService(Context.UI_MODE_SERVICE); isTV = uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION; if (!isTV) { // alternate check isTV = context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEVISION) || context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK) || context.getPackageManager().hasSystemFeature("android.software.leanback_only"); if (isTV && DEBUG) { Log.d(TAG, "isTV: not UI_MODE_TYPE_TELEVISION, however is has system " + "feature suggesting tv"); }/*from w w w.ja va2s .co m*/ if (!isTV) { String[] names = context.getPackageManager().getSystemSharedLibraryNames(); for (String name : names) { if (name.startsWith("com.google.android.tv")) { isTV = true; if (DEBUG) { Log.d(TAG, "isTV: found tv shared library. Assuming tv"); } break; } } } } } else { isTV = false; } } return isTV; }