Java 类com.google.android.gms.common.api.Api 实例源码

项目:FMTech    文件:zznf.java   
public zznf(Context paramContext, zznd paramzznd, Lock paramLock, Looper paramLooper, GoogleApiAvailability paramGoogleApiAvailability, Map<Api.zzc<?>, Api.zzb> paramMap, zzf paramzzf, Map<Api<?>, Integer> paramMap1, Api.zza<? extends zzwz, zzxa> paramzza, ArrayList<zzmw> paramArrayList, zznj.zza paramzza1)
{
  this.mContext = paramContext;
  this.zzXP = paramLock;
  this.zzaon = paramGoogleApiAvailability;
  this.zzapQ = paramMap;
  this.zzapu = paramzzf;
  this.zzapv = paramMap1;
  this.zzaoo = paramzza;
  this.zzaoR = paramzznd;
  this.zzaqn = paramzza1;
  Iterator localIterator = paramArrayList.iterator();
  while (localIterator.hasNext()) {
    ((zzmw)localIterator.next()).zzaoQ = this;
  }
  this.zzaqi = new zzb(paramLooper);
  this.zzaqh = paramLock.newCondition();
  this.zzaqk = new zznc(this);
}
项目:FMTech    文件:zznb.java   
final void zzoX()
{
  ArrayList localArrayList = new ArrayList();
  this.zzapi = 3;
  this.zzapk = this.zzape.zzapQ.size();
  Iterator localIterator = this.zzape.zzapQ.keySet().iterator();
  while (localIterator.hasNext())
  {
    Api.zzc localzzc = (Api.zzc)localIterator.next();
    if (this.zzape.zzaqj.containsKey(localzzc))
    {
      if (zzoT()) {
        zzoY();
      }
    }
    else {
      localArrayList.add(this.zzape.zzapQ.get(localzzc));
    }
  }
  if (!localArrayList.isEmpty()) {
    this.zzapw.add(zzng.zzpp().submit(new zzf(localArrayList)));
  }
}
项目:FMTech    文件:zznb.java   
final Set<Scope> zzpb()
{
  if (this.zzapu == null) {
    return Collections.emptySet();
  }
  HashSet localHashSet = new HashSet(this.zzapu.zzaod);
  Map localMap = this.zzapu.zzatx;
  Iterator localIterator = localMap.keySet().iterator();
  while (localIterator.hasNext())
  {
    Api localApi = (Api)localIterator.next();
    if (!this.zzape.zzaqj.containsKey(localApi.zzor())) {
      localHashSet.addAll(((zzf.zza)localMap.get(localApi)).zzXp);
    }
  }
  return localHashSet;
}
项目:FMTech    文件:zzmw.java   
public final void onConnectionFailed(ConnectionResult paramConnectionResult)
{
  zzoJ();
  zznf localzznf = this.zzaoQ;
  Api localApi = this.zzaoO;
  int i = this.zzaoP;
  localzznf.zzXP.lock();
  try
  {
    localzznf.zzaqk.zza(paramConnectionResult, localApi, i);
    return;
  }
  finally
  {
    localzznf.zzXP.unlock();
  }
}
项目:FMTech    文件:zzna.java   
public final <A extends Api.zzb, T extends zzmu.zza<? extends Result, A>> T zzb(T paramT)
{
  try
  {
    this.zzape.zzaoR.zzb(paramT);
    Api.zzb localzzb = this.zzape.zzaoR.zza(paramT.zzor());
    if ((!localzzb.isConnected()) && (this.zzape.zzaqj.containsKey(paramT.zzor())))
    {
      paramT.zzE(new Status(17));
      return paramT;
    }
    paramT.zzb(localzzb);
    return paramT;
  }
  catch (DeadObjectException localDeadObjectException)
  {
    this.zzape.zza(new zznf.zza(this)
    {
      public final void zzoS()
      {
        zzna.this.onConnectionSuspended(1);
      }
    });
  }
  return paramT;
}
项目:FMTech    文件:zznd.java   
public static int zza$251b1977(Iterable<Api.zzb> paramIterable)
{
  Iterator localIterator = paramIterable.iterator();
  int i = 0;
  if (localIterator.hasNext()) {
    if (!((Api.zzb)localIterator.next()).zzkc()) {
      break label50;
    }
  }
  label50:
  for (int j = 1;; j = i)
  {
    i = j;
    break;
    if (i != 0) {
      return 1;
    }
    return 3;
  }
}
项目:FMTech    文件:zzf.java   
public zzf(Account paramAccount, Set<Scope> paramSet, Map<Api<?>, zza> paramMap, int paramInt, View paramView, String paramString1, String paramString2, zzxa paramzzxa)
{
  this.zzRE = paramAccount;
  if (paramSet == null) {}
  HashSet localHashSet;
  for (Set localSet = Collections.EMPTY_SET;; localSet = Collections.unmodifiableSet(paramSet))
  {
    this.zzaod = localSet;
    if (paramMap == null) {
      paramMap = Collections.EMPTY_MAP;
    }
    this.zzatx = paramMap;
    this.zzaog = paramView;
    this.zzaof = paramInt;
    this.zzUb = paramString1;
    this.zzaoh = paramString2;
    this.zzaor = paramzzxa;
    localHashSet = new HashSet(this.zzaod);
    Iterator localIterator = this.zzatx.values().iterator();
    while (localIterator.hasNext()) {
      localHashSet.addAll(((zza)localIterator.next()).zzXp);
    }
  }
  this.zzatw = Collections.unmodifiableSet(localHashSet);
}
项目:rxactivityresponse    文件:RxPlayServices.java   
@SafeVarargs
public static Observable<GoogleApiClient> getPlayServices(final Activity activity, final RxState state, final String[] permissions, final RxPermissionRationale rationale, final Scope[] scopes, final Api<? extends Api.ApiOptions.NotRequiredOptions>... services) {
    return Observable.create(new GetPermissionStatusObservable(activity, permissions))
            .flatMap(new Function<PermissionResult, Observable<Boolean>>() {
                @Override
                public Observable<Boolean> apply(PermissionResult permissionResult) {
                    return Observable.create(new GetPermissionObservable(activity, state, rationale, permissionResult));
                }
            })
            .flatMap(new Function<Boolean, Observable<GoogleApiClient>>() {
                @Override
                public Observable<GoogleApiClient> apply(Boolean granted) {
                    if (granted) {
                        return Observable.create(new PlayServicesObservable(activity, state, scopes, services));
                    }
                    return Observable.error(new UserAbortedException());
                }
            }).compose(new BaseStateObservable.EndStateTransformer<GoogleApiClient>(state));
}
项目:easygoogle    文件:SignIn.java   
@Override
public Api.ApiOptions.HasOptions getOptionsFor(Api<? extends Api.ApiOptions> api) {
    if (Auth.GOOGLE_SIGN_IN_API.equals(api)) {
        GoogleSignInOptions.Builder googleSignInOptions =  new GoogleSignInOptions.Builder(
                GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestEmail();

        // Check server client id for OAuth, so GoogleSignInAccount.getIdToken(); is non-null
        String serverClientId = getFragment().getServerClientId();
        if(serverClientId != null){
            googleSignInOptions.requestIdToken(serverClientId);
        }
        return googleSignInOptions.build();
    } else {
        return super.getOptionsFor(api);
    }
}
项目:android_external_GmsLib    文件:GoogleApiClientImpl.java   
public GoogleApiClientImpl(Context context, Looper looper, AccountInfo accountInfo,
                           Map<Api, Api.ApiOptions> apis,
                           Set<ConnectionCallbacks> connectionCallbacks,
                           Set<OnConnectionFailedListener> connectionFailedListeners, int clientId) {
    this.context = context;
    this.looper = looper;
    this.handler = new Handler(looper);
    this.accountInfo = accountInfo;
    this.apis.putAll(apis);
    this.connectionCallbacks.addAll(connectionCallbacks);
    this.connectionFailedListeners.addAll(connectionFailedListeners);
    this.clientId = clientId;

    for (Api api : apis.keySet()) {
        apiConnections.put(api, api.getBuilder().build(context, looper,
                apis.get(api), accountInfo, baseConnectionCallbacks,
                baseConnectionFailedListener));
    }
}
项目:RxJava2-weather-example    文件:RxLocationBaseOnSubscribe.java   
protected RxLocationBaseOnSubscribe(@NonNull RxLocation rxLocation, Long timeout, TimeUnit timeUnit) {
    this.ctx = rxLocation.ctx;
    this.services = new Api[]{LocationServices.API};
    this.scopes = null;

    if (timeout != null && timeUnit != null) {
        this.timeoutTime = timeout;
        this.timeoutUnit = timeUnit;
    } else {
        this.timeoutTime = rxLocation.timeoutTime;
        this.timeoutUnit = rxLocation.timeoutUnit;
    }
}
项目:RxJava2-weather-example    文件:RxLocationBaseOnSubscribe.java   
protected RxLocationBaseOnSubscribe(@NonNull Context ctx, @NonNull Api<? extends Api.ApiOptions.NotRequiredOptions>[] services, Scope[] scopes) {
    this.ctx = ctx;
    this.services = services;
    this.scopes = scopes;
    timeoutTime = null;
    timeoutUnit = null;
}
项目:RxGps    文件:RxLocationBaseOnSubscribe.java   
protected RxLocationBaseOnSubscribe(@NonNull RxLocation rxLocation, Long timeout, TimeUnit timeUnit) {
    this.ctx = rxLocation.ctx;
    this.services = new Api[]{ LocationServices.API, ActivityRecognition.API };
    this.scopes = null;

    if (timeout != null && timeUnit != null) {
        this.timeoutTime = timeout;
        this.timeoutUnit = timeUnit;
    } else {
        this.timeoutTime = rxLocation.timeoutTime;
        this.timeoutUnit = rxLocation.timeoutUnit;
    }
}
项目:RxGps    文件:RxLocationBaseOnSubscribe.java   
protected RxLocationBaseOnSubscribe(@NonNull Context ctx, @NonNull Api<? extends Api.ApiOptions.NotRequiredOptions>[] services, Scope[] scopes) {
    this.ctx = ctx;
    this.services = services;
    this.scopes = scopes;
    timeoutTime = null;
    timeoutUnit = null;
}
项目:droidplanner-master    文件:GoogleApiClientManager.java   
public GoogleApiClientManager(Context context, Handler handler, Api<? extends Api.ApiOptions
        .NotRequiredOptions>... apis){
    mContext = context;
    mMainHandler = handler;

    final GoogleApiClient.Builder apiBuilder = new GoogleApiClient.Builder(context);
    for(Api api: apis){
        apiBuilder.addApi(api);
    }

    mGoogleApiClient = apiBuilder.build();
}
项目:droidplanner-master    文件:GoogleApiClientManager.java   
public GoogleApiClientManager(Context context, Api<? extends Api.ApiOptions.NotRequiredOptions>
        ... apis){
    mContext = context;
    mMainHandler = new Handler();

    final GoogleApiClient.Builder apiBuilder = new GoogleApiClient.Builder(context);
    for(Api api: apis){
        apiBuilder.addApi(api);
    }

    mGoogleApiClient = apiBuilder.build();
}
项目:FMTech    文件:zznf.java   
public final void dump(String paramString, FileDescriptor paramFileDescriptor, PrintWriter paramPrintWriter, String[] paramArrayOfString)
{
  String str = paramString + "  ";
  Iterator localIterator = this.zzapv.keySet().iterator();
  while (localIterator.hasNext())
  {
    Api localApi = (Api)localIterator.next();
    paramPrintWriter.append(paramString).append(localApi.mName).println(":");
    ((Api.zzb)this.zzapQ.get(localApi.zzor())).dump$ec96877(str, paramPrintWriter);
  }
}
项目:FMTech    文件:zznc.java   
public final void begin()
{
  Iterator localIterator = this.zzape.zzapQ.values().iterator();
  while (localIterator.hasNext()) {
    ((Api.zzb)localIterator.next()).disconnect();
  }
  this.zzape.zzaoR.zzapR = Collections.emptySet();
}
项目:FMTech    文件:zznb.java   
public zznb(zznf paramzznf, zzf paramzzf, Map<Api<?>, Integer> paramMap, GoogleApiAvailability paramGoogleApiAvailability, Api.zza<? extends zzwz, zzxa> paramzza, Lock paramLock, Context paramContext)
{
  this.zzape = paramzznf;
  this.zzapu = paramzzf;
  this.zzapv = paramMap;
  this.zzaon = paramGoogleApiAvailability;
  this.zzaoo = paramzza;
  this.zzXP = paramLock;
  this.mContext = paramContext;
}
项目:FMTech    文件:zznb.java   
public final void begin()
{
  this.zzape.zzaqj.clear();
  this.zzapj = false;
  this.zzapp = false;
  this.zzapg = null;
  this.zzapi = 0;
  this.zzapo = 2;
  this.zzapq = false;
  this.zzaps = false;
  HashMap localHashMap = new HashMap();
  Iterator localIterator = this.zzapv.keySet().iterator();
  while (localIterator.hasNext())
  {
    Api localApi = (Api)localIterator.next();
    Api.zzb localzzb = (Api.zzb)this.zzape.zzapQ.get(localApi.zzor());
    int i = ((Integer)this.zzapv.get(localApi)).intValue();
    localApi.zzop();
    if (localzzb.zzkc())
    {
      this.zzapp = true;
      if (i < this.zzapo) {
        this.zzapo = i;
      }
      if (i != 0) {
        this.zzapm.add(localApi.zzor());
      }
    }
    localHashMap.put(localzzb, new zzd(this, localApi, i));
  }
  if (this.zzapp)
  {
    this.zzapu.zzaty = Integer.valueOf(System.identityHashCode(this.zzape.zzaoR));
    zzg localzzg = new zzg((byte)0);
    this.zzapn = ((zzwz)this.zzaoo.zza(this.mContext, this.zzape.zzaoR.zzoD, this.zzapu, this.zzapu.zzaor, localzzg, localzzg));
  }
  this.zzapk = this.zzape.zzapQ.size();
  this.zzapw.add(zzng.zzpp().submit(new zze(localHashMap)));
}
项目:FMTech    文件:zznb.java   
public final void zza(ConnectionResult paramConnectionResult, Api<?> paramApi, int paramInt)
{
  if (!zzcN(3)) {}
  do
  {
    return;
    zzb(paramConnectionResult, paramApi, paramInt);
  } while (!zzoT());
  zzoY();
}
项目:FMTech    文件:zznb.java   
final void zzoU()
{
  if (this.zzapk != 0) {}
  ArrayList localArrayList;
  do
  {
    do
    {
      return;
      if (!this.zzapp) {
        break;
      }
    } while (!this.zzapq);
    localArrayList = new ArrayList();
    this.zzapi = 1;
    this.zzapk = this.zzape.zzapQ.size();
    Iterator localIterator = this.zzape.zzapQ.keySet().iterator();
    while (localIterator.hasNext())
    {
      Api.zzc localzzc = (Api.zzc)localIterator.next();
      if (this.zzape.zzaqj.containsKey(localzzc))
      {
        if (zzoT()) {
          zzoW();
        }
      }
      else {
        localArrayList.add(this.zzape.zzapQ.get(localzzc));
      }
    }
  } while (localArrayList.isEmpty());
  this.zzapw.add(zzng.zzpp().submit(new zzh(localArrayList)));
  return;
  zzoX();
}
项目:FMTech    文件:zznb.java   
final void zzoZ()
{
  this.zzapp = false;
  this.zzape.zzaoR.zzapR = Collections.emptySet();
  Iterator localIterator = this.zzapm.iterator();
  while (localIterator.hasNext())
  {
    Api.zzc localzzc = (Api.zzc)localIterator.next();
    if (!this.zzape.zzaqj.containsKey(localzzc)) {
      this.zzape.zzaqj.put(localzzc, new ConnectionResult(17, null));
    }
  }
}
项目:FMTech    文件:zznb.java   
public final void zzoS()
{
  int i = GoogleApiAvailability.isGooglePlayServicesAvailable(zznb.this.mContext);
  if (i != 0)
  {
    final ConnectionResult localConnectionResult = new ConnectionResult(i, null);
    zznb.this.zzape.zza(new zznf.zza(zznb.this)
    {
      public final void zzoS()
      {
        zznb.this.zzi(localConnectionResult);
      }
    });
  }
  for (;;)
  {
    return;
    if (zznb.this.zzapp) {
      zznb.this.zzapn.connect();
    }
    Iterator localIterator = this.zzapE.keySet().iterator();
    while (localIterator.hasNext())
    {
      Api.zzb localzzb = (Api.zzb)localIterator.next();
      localzzb.zza((GoogleApiClient.zza)this.zzapE.get(localzzb));
    }
  }
}
项目:FMTech    文件:zznb.java   
public final void zzoS()
{
  if (zznb.this.zzape.zzaoR.zzapR.isEmpty()) {
    zznb.this.zzape.zzaoR.zzapR = zznb.this.zzpb();
  }
  Iterator localIterator = this.zzapH.iterator();
  while (localIterator.hasNext()) {
    ((Api.zzb)localIterator.next()).zza(zznb.this.zzapr, zznb.this.zzape.zzaoR.zzapR);
  }
}
项目:FMTech    文件:zznb.java   
public final void zzoS()
{
  Iterator localIterator = this.zzapH.iterator();
  while (localIterator.hasNext()) {
    ((Api.zzb)localIterator.next()).zza(zznb.this.zzapr);
  }
}
项目:FMTech    文件:zznd.java   
public zznd(Context paramContext, Lock paramLock, Looper paramLooper, zzf paramzzf, GoogleApiAvailability paramGoogleApiAvailability, Api.zza<? extends zzwz, zzxa> paramzza, Map<Api<?>, Integer> paramMap, List<GoogleApiClient.ConnectionCallbacks> paramList, List<GoogleApiClient.OnConnectionFailedListener> paramList1, Map<Api.zzc<?>, Api.zzb> paramMap1, int paramInt1, int paramInt2, ArrayList<zzmw> paramArrayList)
{
  this.mContext = paramContext;
  this.zzXP = paramLock;
  this.zzapI = new zzk(paramLooper, this.zzapX);
  this.zzoD = paramLooper;
  this.zzapO = new zza(paramLooper);
  this.zzaon = paramGoogleApiAvailability;
  this.zzaol = paramInt1;
  if (this.zzaol >= 0) {
    this.zzapV = Integer.valueOf(paramInt2);
  }
  this.zzapv = paramMap;
  this.zzapQ = paramMap1;
  this.zzapU = paramArrayList;
  Iterator localIterator1 = paramList.iterator();
  while (localIterator1.hasNext())
  {
    GoogleApiClient.ConnectionCallbacks localConnectionCallbacks = (GoogleApiClient.ConnectionCallbacks)localIterator1.next();
    this.zzapI.registerConnectionCallbacks(localConnectionCallbacks);
  }
  Iterator localIterator2 = paramList1.iterator();
  while (localIterator2.hasNext())
  {
    GoogleApiClient.OnConnectionFailedListener localOnConnectionFailedListener = (GoogleApiClient.OnConnectionFailedListener)localIterator2.next();
    this.zzapI.registerConnectionFailedListener(localOnConnectionFailedListener);
  }
  this.zzapu = paramzzf;
  this.zzaoo = paramzza;
}
项目:FMTech    文件:zznd.java   
private void zzcP(int paramInt)
{
  if (this.zzapV == null) {
    this.zzapV = Integer.valueOf(paramInt);
  }
  while (this.zzapJ != null)
  {
    return;
    if (this.zzapV.intValue() != paramInt) {
      throw new IllegalStateException("Cannot use sign-in mode: " + zzcQ(paramInt) + ". Mode was already set to " + zzcQ(this.zzapV.intValue()));
    }
  }
  Iterator localIterator = this.zzapQ.values().iterator();
  int i = 0;
  if (localIterator.hasNext()) {
    if (!((Api.zzb)localIterator.next()).zzkc()) {
      break label282;
    }
  }
  label282:
  for (int j = 1;; j = i)
  {
    i = j;
    break;
    switch (this.zzapV.intValue())
    {
    }
    do
    {
      do
      {
        this.zzapJ = new zznf(this.mContext, this, this.zzXP, this.zzoD, this.zzaon, this.zzapQ, this.zzapu, this.zzapv, this.zzaoo, this.zzapU, this);
        return;
      } while (i != 0);
      throw new IllegalStateException("SIGN_IN_MODE_REQUIRED cannot be used on a GoogleApiClient that does not contain any authenticated APIs. Use connect() instead.");
    } while (i == 0);
    this.zzapJ = new zzmx(this.mContext, this, this.zzXP, this.zzoD, this.zzaon, this.zzapQ, this.zzapu, this.zzapv, this.zzaoo, this.zzapU);
    return;
  }
}
项目:FMTech    文件:zznd.java   
public final <A extends Api.zzb, R extends Result, T extends zzmu.zza<R, A>> T zza(T paramT)
{
  boolean bool;
  if (paramT.zzalR != null) {
    bool = true;
  }
  for (;;)
  {
    zzx.zzb(bool, "This task can not be enqueued (it's probably a Batch or malformed)");
    zzx.zzb(this.zzapQ.containsKey(paramT.zzalR), "GoogleApiClient is not configured to use the API required for this call.");
    this.zzXP.lock();
    try
    {
      if (this.zzapJ == null)
      {
        this.zzapK.add(paramT);
        return paramT;
        bool = false;
        continue;
      }
      zzmu.zza localzza = this.zzapJ.zza(paramT);
      return localzza;
    }
    finally
    {
      this.zzXP.unlock();
    }
  }
}
项目:FMTech    文件:zznd.java   
public final <A extends Api.zzb, T extends zzmu.zza<? extends Result, A>> T zzb(T paramT)
{
  if (paramT.zzalR != null) {}
  for (boolean bool = true;; bool = false)
  {
    zzx.zzb(bool, "This task can not be executed (it's probably a Batch or malformed)");
    this.zzXP.lock();
    try
    {
      if (this.zzapJ != null) {
        break;
      }
      throw new IllegalStateException("GoogleApiClient is not connected yet.");
    }
    finally
    {
      this.zzXP.unlock();
    }
  }
  if (this.zzapL)
  {
    this.zzapK.add(paramT);
    while (!this.zzapK.isEmpty())
    {
      zze localzze = (zze)this.zzapK.remove();
      zzb(localzze);
      localzze.zzE(Status.zzaoB);
    }
    this.zzXP.unlock();
    return paramT;
  }
  zzmu.zza localzza = this.zzapJ.zzb(paramT);
  this.zzXP.unlock();
  return localzza;
}
项目:FMTech    文件:zzmx.java   
public final <A extends Api.zzb, R extends Result, T extends zzmu.zza<R, A>> T zza(T paramT)
{
  if (zzc(paramT))
  {
    if (zzoP())
    {
      paramT.zzE(new Status(4, null, zzoQ()));
      return paramT;
    }
    return this.zzaoT.zza(paramT);
  }
  return this.zzaoS.zza(paramT);
}
项目:FMTech    文件:zzmx.java   
public final <A extends Api.zzb, T extends zzmu.zza<? extends Result, A>> T zzb(T paramT)
{
  if (zzc(paramT))
  {
    if (zzoP())
    {
      paramT.zzE(new Status(4, null, zzoQ()));
      return paramT;
    }
    return this.zzaoT.zzb(paramT);
  }
  return this.zzaoS.zzb(paramT);
}
项目:nongfei-missionplane    文件:GoogleApiClientManager.java   
public GoogleApiClientManager(Context context, Handler handler, Api<? extends Api.ApiOptions
        .NotRequiredOptions>... apis){
    mContext = context;
    mMainHandler = handler;

    final GoogleApiClient.Builder apiBuilder = new GoogleApiClient.Builder(context);
    for(Api api: apis){
        apiBuilder.addApi(api);
    }

    mGoogleApiClient = apiBuilder.build();
}
项目:nongfei-missionplane    文件:GoogleApiClientManager.java   
public GoogleApiClientManager(Context context, Api<? extends Api.ApiOptions.NotRequiredOptions>
        ... apis){
    mContext = context;
    mMainHandler = new Handler();

    final GoogleApiClient.Builder apiBuilder = new GoogleApiClient.Builder(context);
    for(Api api: apis){
        apiBuilder.addApi(api);
    }

    mGoogleApiClient = apiBuilder.build();
}
项目:rxactivityresponse    文件:PlayServicesBaseObservable.java   
@SafeVarargs
public PlayServicesBaseObservable(Activity activity, RxState state, Scope[] scopes, Api<? extends Api.ApiOptions.NotRequiredOptions>... services) {
    super(state);
    this.activity = activity;
    this.scopes = scopes;
    this.services = services;
}
项目:easygoogle    文件:GacFragment.java   
private void buildGoogleApiClient() {
    Log.d(TAG, "buildGoogleApiClient: " + mModules);

    // Can't build a GoogleApiClient with no APIs
    if (mModules.size() == 0) {
        Log.w(TAG, "No APIs, not building GoogleApiClient.");
        return;
    }

    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(getActivity())
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this);

    for (GacModule<?> api : mModules.values()) {
        for (Api apiObj : api.getApis()) {
            // Add Api with options, if possible
            Api.ApiOptions.HasOptions options = api.getOptionsFor(apiObj);
            if (options != null) {
                builder.addApi(apiObj, options);
            } else {
                builder.addApi(apiObj);
            }
        }

        for (Scope scopeObj : api.getScopes()) {
            builder.addScope(scopeObj);
        }
    }

    mGoogleApiClient = builder.build();
}
项目:GooglePlayServiceLocationSupport    文件:AppLocationFragment.java   
@Override
public void addApi(@NonNull Api<? extends Api.ApiOptions.NotRequiredOptions> value) {
    if (mGoogleApiClient != null)
        mGoogleApiClient.disconnect();
    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(mContext).addApi(LocationServices.API).enableAutoManage((FragmentActivity) mContext, new Random().nextInt(Integer.MAX_VALUE), this).
            addConnectionCallbacks(this).addOnConnectionFailedListener(this);
    if (!value.getName().equalsIgnoreCase(LocationServices.API.getName())) {
        addApi(value);
    }
    mGoogleApiClient = builder.build();
    if (!servicesConnected())
        mGoogleApiClient.connect();
}
项目:GooglePlayServiceLocationSupport    文件:AppLocationFragment.java   
@Override
public void addApi(@NonNull Api<? extends Api.ApiOptions.NotRequiredOptions>[] value) {
    if (mGoogleApiClient != null)
        mGoogleApiClient.disconnect();
    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(mContext).addApi(LocationServices.API).enableAutoManage((FragmentActivity) mContext, new Random().nextInt(Integer.MAX_VALUE), this).
            addConnectionCallbacks(this).addOnConnectionFailedListener(this);
    for (Api<? extends Api.ApiOptions.NotRequiredOptions> options : value) {
        if (!options.getName().equalsIgnoreCase(LocationServices.API.getName())) {
            builder.addApi(options);
        }
    }
    mGoogleApiClient = builder.build();
    if (!servicesConnected())
        mGoogleApiClient.connect();
}
项目:GooglePlayServiceLocationSupport    文件:AppLocationActivity.java   
@Override
public void addApi(@NonNull Api<? extends Api.ApiOptions.NotRequiredOptions> value) {
    if (mGoogleApiClient != null)
        mGoogleApiClient.disconnect();
    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(this).addApi(LocationServices.API).enableAutoManage(this, new Random().nextInt(Integer.MAX_VALUE), this).
            addConnectionCallbacks(this).addOnConnectionFailedListener(this);
    if (!value.getName().equalsIgnoreCase(LocationServices.API.getName())) {
        addApi(value);
    }
    mGoogleApiClient = builder.build();
    if (!servicesConnected())
        mGoogleApiClient.connect();
}
项目:GooglePlayServiceLocationSupport    文件:AppLocationActivity.java   
@Override
public void addApi(@NonNull Api<? extends Api.ApiOptions.NotRequiredOptions>[] value) {
    if (mGoogleApiClient != null)
        mGoogleApiClient.disconnect();
    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(this).addApi(LocationServices.API).enableAutoManage(this, new Random().nextInt(Integer.MAX_VALUE), this).
            addConnectionCallbacks(this).addOnConnectionFailedListener(this);
    for (Api<? extends Api.ApiOptions.NotRequiredOptions> options : value) {
        if (!options.getName().equalsIgnoreCase(LocationServices.API.getName())) {
            builder.addApi(options);
        }
    }
    mGoogleApiClient = builder.build();
    if (!servicesConnected())
        mGoogleApiClient.connect();
}