List of usage examples for android.provider Settings ACTION_USAGE_ACCESS_SETTINGS
String ACTION_USAGE_ACCESS_SETTINGS
To view the source code for android.provider Settings ACTION_USAGE_ACCESS_SETTINGS.
Click Source Link
From source file:com.hmatalonga.greenhub.ui.TaskListActivity.java
@TargetApi(21) private void showPermissionInfoDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(getString(R.string.package_usage_permission_text)) .setTitle(getString(R.string.package_usage_permission_title)); builder.setPositiveButton(R.string.open_settings, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User clicked OK button startActivity(new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS)); }/*from www .j av a 2 s . co m*/ }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog dialog.cancel(); } }); builder.create().show(); }
From source file:com.nbplus.vbroadlauncher.HomeLauncherActivity.java
@Override protected void onResume() { super.onResume(); if (Constants.OPEN_BETA_PHONE && LauncherSettings.getInstance(this).isSmartPhone()) { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); }/*from w w w . ja va 2 s. c o m*/ Log.d(TAG, "onResume()"); Intent intent = new Intent(Constants.ACTION_BROWSER_ACTIVITY_CLOSE); LocalBroadcastManager.getInstance(this).sendBroadcast(intent); if (!checkAccessedUsageStats()) { new AlertDialog.Builder(this).setMessage(R.string.alert_action_usage_access_settings) //.setTitle(R.string.alert_network_title) .setCancelable(false) .setPositiveButton(R.string.alert_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { startActivity(new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS)); } }).show(); return; } /** * ? ? ? GPS ? ?? . * ? ? ? ?. */ // TODO : gms ? ? . if (checkPlayServices()) { Log.d(TAG, ">>> checkPlayServices() support"); if (mGoogleApiClient == null || !mGoogleApiClient.isConnected()) { // Building the GoogleApi client buildGoogleApiClient(); createLocationRequest(); buildLocationSettingsRequest(); //if (LauncherSettings.getInstance(this).getPreferredUserLocation() == null) { checkLocationSettings(); //} Log.d(TAG, "HomeLauncherActivity onCreate() call mGoogleApiClient.connect()"); if (mGoogleApiClient != null) { mGoogleApiClient.connect(); } } } else { Log.e(TAG, "Google Play Service is not available !!!!!"); return; } /** * ? ? ?. * ?? ? ? ? ?? ?? ?? . */ // if (!NetworkUtils.isConnected(this)) { // if (!NetworkUtils.isWifiEnabled(this)) { // showWifiEnableAlertDialog(); // } // } }