android.provider.Settings#ACTION_LOCATION_SOURCE_SETTINGS源码实例Demo

下面列出了android.provider.Settings#ACTION_LOCATION_SOURCE_SETTINGS 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: bleYan   文件: BleDevicesFragment.java
public void displayPromptForEnablingGPS() {
    final String action = Settings.ACTION_LOCATION_SOURCE_SETTINGS;


    new MaterialDialog.Builder(getActivity())
            .title(R.string.label_request_open_gps_title)
            .content(R.string.label_request_open_gps_content)
            .positiveText(R.string.label_ok)
            .onPositive(new MaterialDialog.SingleButtonCallback() {

                @Override
                public void onClick(MaterialDialog materialDialog, DialogAction dialogAction) {
                    startActivityForResult(new Intent(action), REQUEST_CODE_OPEN_GPS);
                }
            })
            .negativeText(R.string.label_cancel)
            .cancelable(true)
            .negativeText(R.string.label_cancel)
            .show();
}
 
源代码2 项目: nearby-android   文件: PlacesActivity.java
private void checkSettings() {
  // Is GPS enabled?
  final boolean gpsEnabled = locationTrackingEnabled();
  // Is there internet connectivity?
  final boolean internetConnected = internetConnectivity();

  if (gpsEnabled && internetConnected) {
    completeSetUp();
  } else if (!gpsEnabled) {
    final Intent gpsIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    showDialog(gpsIntent, REQUEST_LOCATION_SETTINGS, getString(R.string.location_tracking_off));
  } else {
    final Intent internetIntent = new Intent(Settings.ACTION_WIFI_SETTINGS);
    showDialog(internetIntent, REQUEST_WIFI_SETTINGS, getString(R.string.wireless_off));
  }
}
 
源代码3 项目: FineGeotag   文件: ActivitySettings.java
@Override
protected void onResume() {
    super.onResume();
    getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);

    SharedPreferences prefs = getPreferenceScreen().getSharedPreferences();

    // Get preferences
    Preference pref_check = findPreference(PREF_CHECK);
    Preference pref_version = findPreference(PREF_VERSION);

    // Set summaries
    onSharedPreferenceChanged(prefs, PREF_ENABLED);
    onSharedPreferenceChanged(prefs, PREF_TOAST);
    onSharedPreferenceChanged(prefs, PREF_ALTITUDE);
    onSharedPreferenceChanged(prefs, PREF_ACCURACY);
    onSharedPreferenceChanged(prefs, PREF_TIMEOUT);
    onSharedPreferenceChanged(prefs, PREF_KNOWN);

    // Location settings
    Intent locationSettingsIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    if (getPackageManager().queryIntentActivities(locationSettingsIntent, 0).size() > 0)
        pref_check.setIntent(locationSettingsIntent);
    else
        pref_check.setEnabled(false);

    // Version
    Intent playStoreIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName()));
    if (getPackageManager().queryIntentActivities(playStoreIntent, 0).size() > 0)
        pref_version.setIntent(playStoreIntent);
    try {
        PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
        pref_version.setSummary(
                pInfo.versionName + "/" + pInfo.versionCode + "\n" +
                        getString(R.string.msg_geocoder) + " " +
                        getString(Geocoder.isPresent() ? R.string.msg_yes : R.string.msg_no));
    } catch (PackageManager.NameNotFoundException ignored) {
    }
}
 
源代码4 项目: android_maplibui   文件: NotificationHelper.java
private static void showLocationNotification(Context context, String title, String info) {
    NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    Intent locationSettings = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    PendingIntent intentNotify = PendingIntent.getActivity(context, 0, locationSettings, PendingIntent.FLAG_CANCEL_CURRENT);

    NotificationCompat.Builder builder = createBuilder(context, R.string.location_accuracy)
            .setContentIntent(intentNotify)
            .setAutoCancel(true)
            .setSmallIcon(R.drawable.ic_location)
            .setContentTitle(title)
            .setContentText(info)
            .setTicker(title);

    manager.notify(NOTIFICATION_GPS_ID, builder.build());
}
 
源代码5 项目: mytracks   文件: GoogleLocationUtils.java
/**
 * Creates a new location settings intent.
 * 
 * @param context the context
 */
public static Intent newLocationSettingsIntent(Context context) {
  Intent intent = new Intent(useGoogleLocationSettings(context) ? ACTION_GOOGLE_LOCATION_SETTINGS
      : Settings.ACTION_LOCATION_SOURCE_SETTINGS);
  intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  return intent;
}
 
源代码6 项目: nongbeer-mvp-android-demo   文件: MapActivity.java
private void startMap(){
    if( isLocationEnable() ){
        mapFragment.getMapAsync( this );
    }else{
        Intent myIntent = new Intent( Settings.ACTION_LOCATION_SOURCE_SETTINGS );
        startActivity( myIntent );
    }
}
 
源代码7 项目: SweetBlue   文件: BleManager.java
/**
 * Overload of {@link #turnOnLocationWithIntent_forOsServices(Activity, int)} if you don't care about result.
 *
 * @see com.idevicesinc.sweetblue.utils.BluetoothEnabler
 */
public final void turnOnLocationWithIntent_forOsServices(final Activity callingActivity)
{
	final Intent enableLocationIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);

	callingActivity.startActivity(enableLocationIntent);

	if( false == Utils.isMarshmallow() )
	{
		m_logger.w("You may use this method but since the phone is at " + Build.VERSION.SDK_INT + " and the requirement is "+Build.VERSION_CODES.M+", it is not necessary for scanning.");
	}
}
 
源代码8 项目: react-native-get-location   文件: SettingsUtil.java
public static void openGpsSettings(final Context context) {
    final String action = Settings.ACTION_LOCATION_SOURCE_SETTINGS;
    Intent intent = new Intent(action);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    context.startActivity(intent);
}
 
源代码9 项目: indigenous-android   文件: BasePlatformCreate.java
/**
 * Open location settings.
 */
private void enableLocationSettings() {
    Intent settingsIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    startActivity(settingsIntent);
}
 
源代码10 项目: mcumgr-android   文件: ScannerActivity.java
@OnClick(R.id.action_enable_location)
public void onEnableLocationClicked() {
    final Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    startActivity(intent);
}
 
源代码11 项目: HereGPSLocation   文件: MainActivity.java
private void clickCheckBox() {
	Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
	startActivity(intent);
	checkBox.setChecked(locationManager.isProviderEnabled("gps"));
}
 
源代码12 项目: android-intents   文件: IntentUtils.java
/**
 * Open system settings location services screen for turning on/off GPS
 */
public static Intent showLocationServices() {
    Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    return intent;
}
 
源代码13 项目: SampleApp   文件: AppUtils.java
/**
 * Redirect user to enable GPS
 */
public void goToGpsSettings() {
    Intent callGPSSettingIntent = new Intent(
            Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    mContext.startActivity(callGPSSettingIntent);
}
 
源代码14 项目: androidnative.pri   文件: Util.java
static void openGPSSettings() {
      Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
      Activity activity = org.qtproject.qt5.android.QtNative.activity();
      activity.startActivity(intent);
}
 
public static void requestLocationEnabling(@NonNull Activity activity) {
    Log.d(TAG, "Requesting location enabling");
    Intent locationSettings = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    activity.startActivity(locationSettings);
}
 
源代码16 项目: AndroidUtilCode   文件: LocationUtils.java
/**
 * 打开Gps设置界面
 */
public static void openGpsSettings() {
    Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    Utils.getApp().startActivity(intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}
 
源代码17 项目: EasyLocation   文件: EasyLocationDelegate.java
private void openLocationSettings() {
    Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    activity.startActivityForResult(intent, ENABLE_LOCATION_SERVICES_REQUEST);
}
 
源代码18 项目: Saude-no-Mapa   文件: EstablishmentFragment.java
@Override
public void startGpsIntent() {
    Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    startActivityForResult(intent, 202);
}
 
源代码19 项目: 365browser   文件: LocationUtils.java
/**
 * Returns an intent to launch Android Location Settings.
 */
public Intent getSystemLocationSettingsIntent() {
    Intent i = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return i;
}
 
private void openLocationSettings() {
    Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
    activity.startActivityForResult(intent, ENABLE_LOCATION_SERVICES_REQUEST);
}