Android Open Source - LocationUpdates Location Service Error Messages






From Project

Back to project page LocationUpdates.

License

The source code is released under:

Apache License

If you think the Android project LocationUpdates listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.locationupdates;
//from  w w  w  .  java 2 s . co  m
import com.google.android.gms.common.ConnectionResult;

import android.content.Context;
import android.content.res.Resources;

public class LocationServiceErrorMessages {

  private LocationServiceErrorMessages() {}
  
  public static String getErrorString(Context context, int errorCode) {
    Resources mResources = context.getResources();
    
    String errorString;
    switch (errorCode) {
    case ConnectionResult.DEVELOPER_ERROR:
      errorString = mResources.getString(R.string.connection_error_misconfigured);
      break;
    case ConnectionResult.INTERNAL_ERROR:
      errorString = mResources.getString(R.string.connection_error_internal);
      break;
    case ConnectionResult.INVALID_ACCOUNT:
            errorString = mResources.getString(R.string.connection_error_invalid_account);
            break;

        case ConnectionResult.LICENSE_CHECK_FAILED:
            errorString = mResources.getString(R.string.connection_error_license_check_failed);
            break;

        case ConnectionResult.NETWORK_ERROR:
            errorString = mResources.getString(R.string.connection_error_network);
            break;

        case ConnectionResult.RESOLUTION_REQUIRED:
            errorString = mResources.getString(R.string.connection_error_needs_resolution);
            break;

        case ConnectionResult.SERVICE_DISABLED:
            errorString = mResources.getString(R.string.connection_error_disabled);
            break;

        case ConnectionResult.SERVICE_INVALID:
            errorString = mResources.getString(R.string.connection_error_invalid);
            break;

        case ConnectionResult.SERVICE_MISSING:
            errorString = mResources.getString(R.string.connection_error_missing);
            break;

        case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
            errorString = mResources.getString(R.string.connection_error_outdated);
            break;

        case ConnectionResult.SIGN_IN_REQUIRED:
            errorString = mResources.getString(R.string.connection_error_sign_in_required);
            break;
    default:
      errorString = mResources.getString(R.string.connection_error_unknown);
      break;
    }
    
    return errorString;
  }
  
}




Java Source Code List

com.example.locationupdates.LocationServiceErrorMessages.java
com.example.locationupdates.LocationUtils.java
com.example.locationupdates.MainActivity.java