當前位置: 首頁>>代碼示例>>Java>>正文


Java LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE屬性代碼示例

本文整理匯總了Java中com.google.android.gms.location.LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE屬性的典型用法代碼示例。如果您正苦於以下問題:Java LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE屬性的具體用法?Java LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE怎麽用?Java LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.google.android.gms.location.LocationSettingsStatusCodes的用法示例。


在下文中一共展示了LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onResult

@Override
public void onResult(LocationSettingsResult result) {
    final Status status = result.getStatus();
    switch (status.getStatusCode()) {
        case LocationSettingsStatusCodes.SUCCESS:
            // All location settings are satisfied -> nothing to do
            callSuccessCallback();
            break;
        case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
            // Location settings are not satisfied. Show the user a dialog to upgrade location settings
            try {
                // Show the dialog by calling startResolutionForResult(), and check the result
                status.startResolutionForResult(mActivity, REQUEST_CHECK_SETTINGS);
            } catch (IntentSender.SendIntentException e) {
                Log.e(TAG, "PendingIntent unable to execute request.", e);
                callErrorCallback();
            }
            break;
        case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
            Log.e(TAG, "Location settings are inadequate, and cannot be fixed here. Dialog not created.");
            callErrorCallback();
            break;
    }
}
 
開發者ID:philiWeitz,項目名稱:react-native-location-switch,代碼行數:24,代碼來源:LocationSwitch.java

示例2: onResult

@Override
public void onResult(@NonNull LocationSettingsResult locationSettingsResult) {
  final Status status = locationSettingsResult.getStatus();
  switch (status.getStatusCode()) {
    case LocationSettingsStatusCodes.SUCCESS:
      // All location settings are satisfied. The client can
      // initialize location requests here.
      continueGPSOperation();
      break;
    case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
      // Location settings are not satisfied, but this can be fixed
      // by showing the user a dialog.
      _result.error("LOCATION DISABLED",
              "This Android device has it's location disabled",
              null);
      break;
    case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
      // Location settings are not satisfied. However, we have no way
      // to fix the settings so we won't show the dialog.
      _result.error("LOCATION DISABLED",
              "This Android device has it's location disabled",
              null);
      break;
  }
}
 
開發者ID:Gustash,項目名稱:flutter_geolocation,代碼行數:25,代碼來源:GpsCoordinatesPlugin.java

示例3: onResult

@Override
public void onResult(@NonNull LocationSettingsResult r) {

    switch (r.getStatus().getStatusCode()) {
        case LocationSettingsStatusCodes.SUCCESS:
            gpsIsTurnedOn = true;
            break;
        case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
            try {
                r.getStatus().startResolutionForResult(activity, SideBarActivity.REQUEST_CHECK_SETTINGS);
            } catch (IntentSender.SendIntentException ignored) {
                ignored.printStackTrace();
            }
            break;
        case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
            gpsIsTurnedOn = false;
            break;
    }
}
 
開發者ID:IrrilevantHappyLlamas,項目名稱:Runnest,代碼行數:19,代碼來源:LocationSettingsHandler.java

示例4: onResult

@Override
public void onResult(@NonNull LocationSettingsResult locationSettingsResult) {
  final Status status = locationSettingsResult.getStatus();
  switch (status.getStatusCode()) {
    case LocationSettingsStatusCodes.SUCCESS:
      startLocationUpdates();
      break;
    case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
      try {
        status.startResolutionForResult(LocationActivity.this, REQUEST_CHECK_LOCATION_SETTINGS);
      } catch (IntentSender.SendIntentException e) {
        e.printStackTrace();
        Log.i(TAG, "PendingIntent unable to execute request.");
      }
      break;
    case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
      Log.i(TAG, "Location settings are inadequate, and cannot be fixed here. Dialog not created.");
      break;
  }
}
 
開發者ID:drfonfon,項目名稱:ITagAntiLost,代碼行數:20,代碼來源:LocationActivity.java

示例5: onResult

@Override
public void onResult(LocationSettingsResult result) {
    final Status status = result.getStatus();
    switch (status.getStatusCode()) {
        case LocationSettingsStatusCodes.SUCCESS:
            // All location settings are satisfied. The client can
            // initialize location requests here.
            startLocationUpdates();
            break;
        case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
            // Location settings are not satisfied, but this can be fixed
            // by showing the user a dialog.
            break;
        case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
            // Location settings are not satisfied. However, we have no way
            // to fix the settings so we won't show the dialog.

            break;
    }
}
 
開發者ID:RSDT,項目名稱:Japp16,代碼行數:20,代碼來源:LocationProviderService.java

示例6: onResult

@Override
public void onResult(LocationSettingsResult locationSettingsResult) {
    final Status status = locationSettingsResult.getStatus();
    switch (status.getStatusCode()) {
        case LocationSettingsStatusCodes.SUCCESS:
            Log.i(LOG_TAG, "All location settings are satisfied.");
            startLocationUpdates();
            break;
        case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
            Log.i(LOG_TAG, "Location settings are not satisfied. Show the user a dialog to" +
                    "upgrade location settings ");

            try {
                // Show the dialog by calling startResolutionForResult(), and check the result
                // in onActivityResult().
                status.startResolutionForResult(MainActivity.this, REQUEST_CHECK_SETTINGS);
            } catch (IntentSender.SendIntentException e) {
                Log.i(LOG_TAG, "PendingIntent unable to execute request.");
            }
            break;
        case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
            Log.i(LOG_TAG, "Location settings are inadequate, and cannot be fixed here. Dialog " +
                    "not created.");
            break;
    }
}
 
開發者ID:Greplr,項目名稱:Greplr_Android,代碼行數:26,代碼來源:MainActivity.java

示例7: onResult

@Override
public void onResult(LocationSettingsResult locationSettingsResult) {
    final Status status = locationSettingsResult.getStatus();
    switch (status.getStatusCode()) {
        case LocationSettingsStatusCodes.SUCCESS:
            Log.i(TAG, "All location settings are satisfied.");
            GetLastLocation();
            break;
        case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
            Log.i(TAG, "Location settings are not satisfied. Show the user a dialog to" +
                    "upgrade location settings ");

            try {
                // Show the dialog by calling startResolutionForResult(), and check the result
                // in onActivityResult().
                status.startResolutionForResult(mActivity, REQUEST_CHECK_SETTINGS);
            } catch (IntentSender.SendIntentException e) {                   
                ErrorHappened("PendingIntent unable to execute request.");
            }
            break;
        case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:              
            ErrorHappened("Location settings are inadequate, and cannot be fixed here. Dialog " +
                    "not created.");
            break;
    }
}
 
開發者ID:snokleby,項目名稱:cordova-fusedlocation,代碼行數:26,代碼來源:FusedLocationHelper.java

示例8: isLocationEnabled

@Override
protected boolean isLocationEnabled() {
    if (mLastStatus != null) {
        if (mLastStatus.hasResolution()) {
            try {
                startIntentSenderForResult(mLastStatus.getResolution().getIntentSender(),
                    REQUEST_LOCATION, null, 0, 0, 0, null);
            }
            catch (IntentSender.SendIntentException e) {
                Toast.makeText(getContext(), R.string.err_location_access_unknown_error,
                    Toast.LENGTH_LONG).show();
            }
        }
        else if (mLastStatus.getStatusCode() == LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE) {
            // no location no party!
            Toast.makeText(getContext(), R.string.err_location_access_unknown_error,
                Toast.LENGTH_LONG).show();
        }
        return false;
    }
    return true;
}
 
開發者ID:kontalk,項目名稱:androidclient,代碼行數:22,代碼來源:PositionGoogleFragment.java

示例9: isLocationEnabled

protected boolean isLocationEnabled() {
    if (mLastStatus != null) {
        if (mLastStatus.hasResolution()) {
            try {
                startIntentSenderForResult(mLastStatus.getResolution().getIntentSender(),
                    REQUEST_LOCATION, null, 0, 0, 0, null);
            }
            catch (IntentSender.SendIntentException e) {
                Toast.makeText(getContext(), R.string.err_location_access_unknown_error,
                    Toast.LENGTH_LONG).show();
            }
        }
        else if (mLastStatus.getStatusCode() == LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE) {
            // no location no party!
            Toast.makeText(getContext(), R.string.err_location_access_unknown_error,
                Toast.LENGTH_LONG).show();
        }
        return false;
    }
    return true;
}
 
開發者ID:kontalk,項目名稱:androidclient,代碼行數:21,代碼來源:SendPositionGoogleFragment.java

示例10: getLocationSettingsResultCallback

@NonNull
private ResultCallback<Result> getLocationSettingsResultCallback() {
    return new ResultCallback<Result>() {
        @Override
        public void onResult(@NonNull Result result) {
            Status status = result.getStatus();
            if (status.getStatusCode() == CommonStatusCodes.SUCCESS) {
                Log.i(TAG, "All location settings are satisfied.");
                Runnable requestUpdatesTask = new OnPermissionsTask();
                if (isConnected()) requestUpdatesTask.run();
                else {
                    mOnConnectedUpdateCallback = requestUpdatesTask;
                    Log.d(TAG, "Google API is not connected. "
                            + "Updates delayed until Google API is connected again.");
                }
            } else if (status.getStatusCode() == CommonStatusCodes.RESOLUTION_REQUIRED) {
                Log.i(TAG, "Location settings are not satisfied. "
                        + "Showing the user a dialog to upgrade location settings.");
                try {
                    setRequestingPermissions(true);
                    // Show the dialog by calling startResolutionForResult(),
                    // and check the result in the onActivityResult() of mContext
                    status.startResolutionForResult(mContext, REQUEST_CHECK_SETTINGS);
                } catch (IntentSender.SendIntentException e) {
                    Log.wtf(TAG, "PendingIntent unable to execute request", e);
                }
            } else if (status.getStatusCode()
                    == LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE) {
                if (checkNetwork()) {
                    Log.w(TAG, "Location settings can't be changed to meet the requirements");
                    setHasPermissions(false);
                    mOnPermissionsChangedListeners.run();
                    setRequestingPermissions(false);
                }
            }
        }
    };
}
 
開發者ID:ArnauBlanch,項目名稱:civify-app,代碼行數:38,代碼來源:LocationAdapter.java

示例11: checkSettingsStatus

private void checkSettingsStatus(Status status) {
    logger.log(TAG, "checkSettingsStatus -> settings status = " + status);
    switch (status.getStatusCode()) {
        case LocationSettingsStatusCodes.SUCCESS:
            logger.log(TAG, "checkSettingsStatus:Location is enabled");
            break;
        case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
            logger.log(TAG, "checkSettingsStatus:Location settings are not satisfied. Show the user a dialog to upgrade location settings ");
        case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
            throw new LocationSettingsException(status);
    }
}
 
開發者ID:titanium-codes,項目名稱:LocGetter,代碼行數:12,代碼來源:LocationGetterImpl.java

示例12: onResult

/**
     * The callback invoked when
     * {@link com.google.android.gms.location.SettingsApi#checkLocationSettings(GoogleApiClient,
     * LocationSettingsRequest)} is called. Examines the
     * {@link com.google.android.gms.location.LocationSettingsResult} object and determines if
     * location settings are adequate. If they are not, begins the process of presenting a location
     * settings dialog to the user.
     */
    @Override
    public void onResult(LocationSettingsResult locationSettingsResult) {
        final Status status = locationSettingsResult.getStatus();
        switch (status.getStatusCode()) {
            case LocationSettingsStatusCodes.SUCCESS:
                Log.i(this.getLocalClassName(), "All location settings are satisfied.");
//                startLocationUpdates();
                requestingLocationUpdates = true;
                break;
            case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
                Log.i(this.getLocalClassName(), "Location settings are not satisfied. Show the user a dialog to " +
                        "upgrade location settings ");
                try {
                    // Show the dialog by calling startResolutionForResult(), and check the result in onActivityResult().
                    status.startResolutionForResult(TabbedListActivity.this, REQUEST_CHECK_SETTINGS);
                } catch (IntentSender.SendIntentException e) {
                    //TODO
                    Log.i(this.getLocalClassName(), "PendingIntent unable to execute request.");
                }
                break;
            case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
                //TODO
                Log.i(this.getLocalClassName(), "Location settings are inadequate, and cannot be fixed here. Dialog " +
                        "not created.");
                break;
        }
    }
 
開發者ID:luontonurkka,項目名稱:app,代碼行數:35,代碼來源:TabbedListActivity.java

示例13: onResult

@Override
public void onResult(LocationSettingsResult locationSettingsResult) {
    final Status status = locationSettingsResult.getStatus();
    switch (status.getStatusCode()) {
        case LocationSettingsStatusCodes.SUCCESS:
            logger.d("All location settings are satisfied.");
            fulfilledCheckLocationSettings = true;
            startUpdating(locationRequest);
            break;
        case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
            logger.w("Location settings are not satisfied. Show the user a dialog to" +
                    "upgrade location settings. You should hook into the Activity onActivityResult and call this provider onActivityResult method for continuing this call flow. ");

            if (context instanceof Activity) {
                try {
                    // Show the dialog by calling startResolutionForResult(), and check the result
                    // in onActivityResult().
                    status.startResolutionForResult((Activity) context, REQUEST_CHECK_SETTINGS);
                } catch (IntentSender.SendIntentException e) {
                    logger.i("PendingIntent unable to execute request.");
                }

            } else {
                logger.w("Provided context is not the context of an activity, therefore we cant launch the resolution activity.");
            }
            break;
        case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
            logger.i("Location settings are inadequate, and cannot be fixed here. Dialog " +
                    "not created.");
            stop();
            break;
    }
}
 
開發者ID:simplesoft-duongdt3,項目名稱:Android-App-Template,代碼行數:33,代碼來源:LocationGooglePlayServicesProvider.java

示例14: onResult

@Override
public void onResult(LocationSettingsResult result) {
    // Get status
    final Status status = result.getStatus();
    Log.i(this.getClass().getSimpleName(), "LocationSettingsResult is: " + status.getStatusMessage());

    switch (status.getStatusCode()) {
        case LocationSettingsStatusCodes.SUCCESS:
            // All location settings are satisfied. Initialize location updates request.
            if (!mUpdatingLocation) {
                this.startLocationUpdates();
            }

            break;

        case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
            // Location settings are not satisfied, but this can be fixed
            // by showing the user a dialog.
            try {
                // Show the dialog by calling startResolutionForResult(),
                // and check the result in onActivityResult().
                mResolvingSettings = true;
                status.startResolutionForResult(this, REQUEST_CHECK_SETTINGS);

            } catch (IntentSender.SendIntentException e) {
                // Ignore the error.
            }
            break;

        case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
            // Location settings are not satisfied. However, we have no way
            // to fix the settings so we won't show the dialog.
            // TODO explain to user
            break;
    }
}
 
開發者ID:jtklein,項目名稱:2016GBIFchallenge,代碼行數:36,代碼來源:SgActivityMap.java

示例15: onResult

@Override
public void onResult(LocationSettingsResult locationSettingsResult) {
    final Status status = locationSettingsResult.getStatus();
    switch (status.getStatusCode()) {
        case LocationSettingsStatusCodes.SUCCESS:

            // NO need to show the dialog;

            break;

        case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
            //  Location settings are not satisfied. Show the user a dialog

            try {
                // Show the dialog by calling startResolutionForResult(), and check the result
                // in onActivityResult().

                status.startResolutionForResult(this, REQUEST_CHECK_SETTINGS);

            } catch (IntentSender.SendIntentException e) {

                //unable to execute request
            }
            break;

        case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
            // Location settings are inadequate, and cannot be fixed here. Dialog not created
            break;
    }
}
 
開發者ID:jbj88817,項目名稱:getLastLocationUsingGPS-android,代碼行數:30,代碼來源:MapsActivity.java


注:本文中的com.google.android.gms.location.LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。