当前位置: 首页>>代码示例>>Java>>正文


Java LocationSettingsResult.getStatus方法代码示例

本文整理汇总了Java中com.google.android.gms.location.LocationSettingsResult.getStatus方法的典型用法代码示例。如果您正苦于以下问题:Java LocationSettingsResult.getStatus方法的具体用法?Java LocationSettingsResult.getStatus怎么用?Java LocationSettingsResult.getStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.location.LocationSettingsResult的用法示例。


在下文中一共展示了LocationSettingsResult.getStatus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onResult

import com.google.android.gms.location.LocationSettingsResult; //导入方法依赖的package包/类
@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,代码行数:25,代码来源:LocationSwitch.java

示例2: onResult

import com.google.android.gms.location.LocationSettingsResult; //导入方法依赖的package包/类
@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,代码行数:26,代码来源:GpsCoordinatesPlugin.java

示例3: onResult

import com.google.android.gms.location.LocationSettingsResult; //导入方法依赖的package包/类
@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,代码行数:21,代码来源:LocationActivity.java

示例4: onResult

import com.google.android.gms.location.LocationSettingsResult; //导入方法依赖的package包/类
@Override
public void onResult(@NonNull LocationSettingsResult result) {
    final Status status = result.getStatus();
    switch (status.getStatusCode()) {
        case LocationSettingsStatusCodes.SUCCESS:
            mLocationActivityListener.onSettingsCheckSuccess();
            break;
        case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
            try {
                startResolvingSettingsProblem(status);
            } catch (IntentSender.SendIntentException e) {
                mLocationActivityListener.onSettingsCheckFailure();
            }
            break;
        default:
            mLocationActivityListener.onSettingsCheckFailure();
            break;
    }
}
 
开发者ID:BottleRocketStudios,项目名称:Android-Continuity,代码行数:20,代码来源:BaseLocationActivity.java

示例5: onResult

import com.google.android.gms.location.LocationSettingsResult; //导入方法依赖的package包/类
@Override
public void onResult(LocationSettingsResult result) {
    Status status = result.getStatus();
    switch (status.getStatusCode()) {
        case LocationSettingsStatusCodes.SUCCESS:
            wasSending = JappPreferences.isUpdatingLocationToServer();
            if (!wasSending) {
                showLocationNotification("Japp verzendt je locatie niet!", Color.rgb(244, 66, 66));
            } else {
                showLocationNotification("Japp verzendt je locatie", Color.rgb(113, 244, 66));
            }
            break;
        case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
            if(listener != null) {
                listener.onResolutionRequired(status);
            }
            break;
    }
}
 
开发者ID:RSDT,项目名称:Japp16,代码行数:20,代码来源:LocationService.java

示例6: onResult

import com.google.android.gms.location.LocationSettingsResult; //导入方法依赖的package包/类
@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,代码行数:21,代码来源:LocationProviderService.java

示例7: onResult

import com.google.android.gms.location.LocationSettingsResult; //导入方法依赖的package包/类
@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,代码行数:27,代码来源:MainActivity.java

示例8: onResult

import com.google.android.gms.location.LocationSettingsResult; //导入方法依赖的package包/类
@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,代码行数:27,代码来源:FusedLocationHelper.java

示例9: onResult

import com.google.android.gms.location.LocationSettingsResult; //导入方法依赖的package包/类
/**
     * 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,代码行数:36,代码来源:TabbedListActivity.java

示例10: onResult

import com.google.android.gms.location.LocationSettingsResult; //导入方法依赖的package包/类
@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,代码行数:34,代码来源:LocationGooglePlayServicesProvider.java

示例11: onResult

import com.google.android.gms.location.LocationSettingsResult; //导入方法依赖的package包/类
@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,代码行数:37,代码来源:SgActivityMap.java

示例12: onResult

import com.google.android.gms.location.LocationSettingsResult; //导入方法依赖的package包/类
@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,代码行数:31,代码来源:MapsActivity.java

示例13: onResult

import com.google.android.gms.location.LocationSettingsResult; //导入方法依赖的package包/类
/**
 * 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(TAG, "All location settings are satisfied.");
            startLocationUpdates();
            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(FusedLocationManager.this, REQUEST_CHECK_SETTINGS);
            } catch (IntentSender.SendIntentException e) {
                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:hemant3370,项目名称:Picoroid,代码行数:35,代码来源:FusedLocationManager.java

示例14: onResult

import com.google.android.gms.location.LocationSettingsResult; //导入方法依赖的package包/类
@Override
public void onResult(@NonNull LocationSettingsResult result) {
    if (result.getStatus().isSuccess()) {
        requestAndPollLastLocation();
    }
    else {
        mLastStatus = result.getStatus();
    }
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:10,代码来源:PositionGoogleFragment.java

示例15: onResult

import com.google.android.gms.location.LocationSettingsResult; //导入方法依赖的package包/类
@Override
public void onResult(@NonNull LocationSettingsResult result) {
    if (result.getStatus().isSuccess()) {
        requestAndPollLastLocation();
    }
    else {
        mLastStatus = result.getStatus();
        // this will trigger the location services dialog
        isLocationEnabled();
    }
}
 
开发者ID:kontalk,项目名称:androidclient,代码行数:12,代码来源:SendPositionGoogleFragment.java


注:本文中的com.google.android.gms.location.LocationSettingsResult.getStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。