• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AppStateManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.android.gms.appstate.AppStateManager的典型用法代码示例。如果您正苦于以下问题:Java AppStateManager类的具体用法?Java AppStateManager怎么用?Java AppStateManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AppStateManager类属于com.google.android.gms.appstate包,在下文中一共展示了AppStateManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: if

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
private GoogleApiClient.Builder ˏ()
{
  if (this.ι)
    throw new IllegalStateException("GameHelper: you called GameHelper.createApiClientBuilder() after calling setup. You can only get a client builder BEFORE performing setup.");
  GoogleApiClient.Builder localBuilder = new GoogleApiClient.Builder(this.ˋ, this, this);
  if ((0x1 & this.ˏ) != 0)
  {
    localBuilder.addApi(Games.API, null);
    localBuilder.addScope(Games.SCOPE_GAMES);
  }
  if ((0x2 & this.ˏ) != 0)
  {
    localBuilder.addApi(Plus.API, null);
    localBuilder.addScope(Plus.SCOPE_PLUS_LOGIN);
  }
  if ((0x4 & this.ˏ) != 0)
  {
    localBuilder.addApi(AppStateManager.API, null);
    localBuilder.addScope(AppStateManager.SCOPE_APP_STATE);
  }
  this.ˉ = localBuilder;
  return localBuilder;
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:24,代码来源:Ô¨ª.java


示例2: onCreate

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mPreferences = getSharedPreferences("gdg",MODE_PRIVATE);

    if(!Utils.isEmulator()) {

        mGoogleApiClient = new GoogleApiClient.Builder(this)
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
                .addApi(Plus.API)
                .addApi(Games.API)
                .addApi(AppStateManager.API)
                .addScope(Plus.SCOPE_PLUS_LOGIN)
                .addScope(Plus.SCOPE_PLUS_PROFILE)
                .addScope(Games.SCOPE_GAMES)
                .build();
    }

    mAchievementActionHandler =
            new AchievementActionHandler(getHandler(), mGoogleApiClient, mPreferences);

    if (getSupportActionBar() != null)
        getSupportActionBar().setDisplayShowTitleEnabled(false);
}
 
开发者ID:gdgjodhpur,项目名称:gdgapp,代码行数:27,代码来源:GdgActivity.java


示例3: GamesClientHelperImpl

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
public GamesClientHelperImpl(Activity activity,
		GamesClientHelperListener listener) {
	this.activity = activity;
	this.listener = listener;

	GoogleApiClient.Builder builder = new GoogleApiClient.Builder(
			this.activity, this, this);

	builder.addApi(Games.API, gamesApiOptions);
	builder.addScope(Games.SCOPE_GAMES);

	builder.addApi(Plus.API, plusApiOptions);
	builder.addScope(Plus.SCOPE_PLUS_LOGIN);

	builder.addApi(AppStateManager.API, appStateApiOptions);
	builder.addScope(AppStateManager.SCOPE_APP_STATE);

	googleApiClient = builder.build();
}
 
开发者ID:DeNADev,项目名称:GooglePlayServicesGameSample,代码行数:20,代码来源:GamesClientHelperImpl.java


示例4: createApiClientBuilder

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
/**
 * Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally,
 * you do not have to do this; use this method only if you need to make
 * nonstandard setup (e.g. adding extra scopes for other APIs) on the
 * GoogleApiClient.Builder before calling @link{#setup}.
 */
public GoogleApiClient.Builder createApiClientBuilder() {
    if (mSetupDone) {
        String error = "GameHelper: you called GameHelper.createApiClientBuilder() after "
                + "calling setup. You can only get a client builder BEFORE performing setup.";
        logError(error);
        throw new IllegalStateException(error);
    }

    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(
            mActivity, this, this);

    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        builder.addApi(Games.API, mGamesApiOptions);
        builder.addScope(Games.SCOPE_GAMES);
    }

    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        builder.addApi(Plus.API);
        builder.addScope(Plus.SCOPE_PLUS_LOGIN);
    }

    if (0 != (mRequestedClients & CLIENT_APPSTATE)) {
        builder.addApi(AppStateManager.API);
        builder.addScope(AppStateManager.SCOPE_APP_STATE);
    }

    if (0 != (mRequestedClients & CLIENT_SNAPSHOT)) {
        builder.addScope(Drive.SCOPE_APPFOLDER);
        builder.addApi(Drive.API);
    }

    mGoogleApiClientBuilder = builder;
    return builder;
}
 
开发者ID:PacktPublishing,项目名称:Android-Game-Programming,代码行数:41,代码来源:GameHelper.java


示例5: createApiClientBuilder

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
/**
 * Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally,
 * you do not have to do this; use this method only if you need to make
 * nonstandard setup (e.g. adding extra scopes for other APIs) on the
 * GoogleApiClient.Builder before calling @link{#setup}.
 */
public GoogleApiClient.Builder createApiClientBuilder() {
    if (mSetupDone) {
        String error = "GameHelper: you called GameHelper.createApiClientBuilder() after "
                + "calling setup. You can only get a client builder BEFORE performing setup.";
        logError(error);
        throw new IllegalStateException(error);
    }

    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(
            mActivity, this, this);

    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        builder.addApi(Games.API, mGamesApiOptions);
        builder.addScope(Games.SCOPE_GAMES);
    }

    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        builder.addApi(Plus.API);
        builder.addScope(Plus.SCOPE_PLUS_LOGIN);
    }

    if (0 != (mRequestedClients & CLIENT_APPSTATE)) {
        builder.addApi(AppStateManager.API);
        builder.addScope(AppStateManager.SCOPE_APP_STATE);
    }

    if (0 != (mRequestedClients & CLIENT_SNAPSHOT)) {
      builder.addScope(Drive.SCOPE_APPFOLDER);
      builder.addApi(Drive.API);
    }

    mGoogleApiClientBuilder = builder;
    return builder;
}
 
开发者ID:PacktPublishing,项目名称:Android-Game-Programming,代码行数:41,代码来源:GameHelper.java


示例6: onCreate

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Build API client with access to Games, AppState, and SavedGames.
    // It is very important to add Drive or the SavedGames API will not work
    // Make sure to also go to console.developers.google.com and enable the Drive API for your
    // project
    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(Games.API).addScope(Games.SCOPE_GAMES) // Games
            .addApi(AppStateManager.API).addScope(AppStateManager.SCOPE_APP_STATE) // AppState
            .addScope(Drive.SCOPE_APPFOLDER) // SavedGames
            .build();

    // Set up button listeners
    findViewById(R.id.button_sign_in).setOnClickListener(this);

    findViewById(R.id.button_cloud_save_load).setOnClickListener(this);
    findViewById(R.id.button_cloud_save_update).setOnClickListener(this);
    findViewById(R.id.button_cloud_save_migrate).setOnClickListener(this);

    findViewById(R.id.button_saved_games_load).setOnClickListener(this);
    findViewById(R.id.button_saved_games_update).setOnClickListener(this);
    findViewById(R.id.button_saved_games_select).setOnClickListener(this);
}
 
开发者ID:NahroTo,项目名称:Fruit-Destroyer,代码行数:29,代码来源:MainActivity.java


示例7: cloudSaveLoad

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
/**
 * Async load AppState from Cloud Save.  This will load using stateKey APP_STATE_KEY.  After load,
 * the AppState data and metadata will be displayed.
 */
private void cloudSaveLoad() {
    PendingResult<AppStateManager.StateResult> pendingResult = AppStateManager.load(
            mGoogleApiClient, APP_STATE_KEY);

    showProgressDialog("Loading Cloud Save");
    ResultCallback<AppStateManager.StateResult> callback =
            new ResultCallback<AppStateManager.StateResult>() {
        @Override
        public void onResult(AppStateManager.StateResult stateResult) {
            if (stateResult.getStatus().isSuccess()) {
                // Successfully loaded data from App State
                displayMessage(getString(R.string.cloud_save_load_success), false);
                byte[] data = stateResult.getLoadedResult().getLocalData();
                setData(new String(data));
                displayAppStateMetadata(stateResult.getLoadedResult().getStateKey());
            } else {
                // Failed to load data from App State
                displayMessage(getString(R.string.cloud_save_load_failure), true);
                clearDataUI();
            }

            dismissProgressDialog();
        }
    };
    pendingResult.setResultCallback(callback);
}
 
开发者ID:NahroTo,项目名称:Fruit-Destroyer,代码行数:31,代码来源:MainActivity.java


示例8: cloudSaveUpdate

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
/**
 * Async update AppState data in Cloud Save.  This will use stateKey APP_STATE_KEY. After save,
 * the UI will be cleared and the data will be available to load from Cloud Save.
 */
private void cloudSaveUpdate() {
    // Use the data from the EditText as AppState data
    byte[] data = getData().getBytes();

    // Use updateImmediate to update the AppState data.  This is used for diagnostic purposes
    // so that the app can display the result of the update, however it is generally recommended
    // to use AppStateManager.update(...) in order to reduce performance and battery impact.
    PendingResult<AppStateManager.StateResult> pendingResult = AppStateManager.updateImmediate(
            mGoogleApiClient, APP_STATE_KEY, data);

    showProgressDialog("Updating Cloud Save");
    ResultCallback<AppStateManager.StateResult> callback =
            new ResultCallback<AppStateManager.StateResult>() {
        @Override
        public void onResult(AppStateManager.StateResult stateResult) {
            if (stateResult.getStatus().isSuccess()) {
                displayMessage(getString(R.string.cloud_save_update_success), false);
            } else {
                displayMessage(getString(R.string.cloud_save_update_failure), true);
            }

            dismissProgressDialog();
            clearDataUI();
        }
    };
    pendingResult.setResultCallback(callback);
}
 
开发者ID:NahroTo,项目名称:Fruit-Destroyer,代码行数:32,代码来源:MainActivity.java


示例9: createApiClientBuilder

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
/**
 * Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally,
 * you do not have to do this; use this method only if you need to make
 * nonstandard setup (e.g. adding extra scopes for other APIs) on the
 * GoogleApiClient.Builder before calling @link{#setup}.
 */
public GoogleApiClient.Builder createApiClientBuilder() {
    if (mSetupDone) {
        String error = "GameHelper: you called GameHelper.createApiClientBuilder() after "
                + "calling setup. You can only get a client builder BEFORE performing setup.";
        logError(error);
        throw new IllegalStateException(error);
    }

    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(
            mActivity, this, this);

    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        builder.addApi(Games.API, mGamesApiOptions);
        builder.addScope(Games.SCOPE_GAMES);
    }

    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        builder.addApi(Plus.API, mPlusApiOptions);
        builder.addScope(Plus.SCOPE_PLUS_LOGIN);
    }

    if (0 != (mRequestedClients & CLIENT_APPSTATE)) {
        builder.addApi(AppStateManager.API);
        builder.addScope(AppStateManager.SCOPE_APP_STATE);
    }

    mGoogleApiClientBuilder = builder;
    return builder;
}
 
开发者ID:igorcrevar,项目名称:GoingUnder,代码行数:36,代码来源:GameHelper.java


示例10: addTaggedPersonToCloudSave

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
private void addTaggedPersonToCloudSave(String id) {
    previous = previous + ID_SPLIT_CHAR + id;
    AppStateManager.update(getGoogleApiClient(), Const.ARROW_DONE_STATE_KEY, previous.getBytes());
    Games.Leaderboards.submitScore(getGoogleApiClient(), Const.ARROW_LB, previous.split("\\|").length-1);

    Plus.PeopleApi.load(getGoogleApiClient(), id).setResultCallback(new ResultCallback<People.LoadPeopleResult>() {
        @Override
        public void onResult(People.LoadPeopleResult loadPeopleResult) {
            Person organizer = loadPeopleResult.getPersonBuffer().get(0);
            Toast.makeText(ArrowActivity.this, "It worked...you tagged " + organizer.getDisplayName(), Toast.LENGTH_LONG).show();
        }
    });
}
 
开发者ID:gdgjodhpur,项目名称:gdgapp,代码行数:14,代码来源:ArrowActivity.java


示例11: createApiClientBuilder

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
/**
 * Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally, you do not have
 * to do this; use this method only if you need to make nonstandard setup (e.g. adding
 * extra scopes for other APIs) on the GoogleApiClient.Builder before calling @link{#setup}.
 */
public GoogleApiClient.Builder createApiClientBuilder() {
    if (mSetupDone) {
        String error = "GameHelper: you called GameHelper.createApiClientBuilder() after " +
                "calling setup. You can only get a client builder BEFORE performing setup.";
        logError(error);
        throw new IllegalStateException(error);
    }

    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(mActivityForDialogs, this, this);

    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        builder.addApi(Games.API, mGamesApiOptions);
        builder.addScope(Games.SCOPE_GAMES);
    }

    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        builder.addApi(Plus.API, mPlusApiOptions);
        builder.addScope(Plus.SCOPE_PLUS_LOGIN);
    }

    if (0 != (mRequestedClients & CLIENT_APPSTATE)) {
        builder.addApi(AppStateManager.API, mAppStateApiOptions);
        builder.addScope(AppStateManager.SCOPE_APP_STATE);
    }
    
    builder.setViewForPopups(mActivityForDialogs.getWindow().getDecorView().findViewById(android.R.id.content));

    mGoogleApiClientBuilder = builder;
    return builder;
}
 
开发者ID:AlexShafir,项目名称:google-play-game-services-ane,代码行数:36,代码来源:GameHelper.java


示例12: createApiClientBuilder

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
/**
 * Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally,
 * you do not have to do this; use this method only if you need to make
 * nonstandard setup (e.g. adding extra scopes for other APIs) on the
 * GoogleApiClient.Builder before calling @link{#setup}.
 */
public GoogleApiClient.Builder createApiClientBuilder() {
    if (mSetupDone) {
        String error = "GameHelper: you called GameHelper.createApiClientBuilder() after "
                + "calling setup. You can only get a client builder BEFORE performing setup.";
        logError(error);
        throw new IllegalStateException(error);
    }

    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(
            mActivity, this, this);

    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        if (mGamesApiOptions != null) {
            builder.addApi(Games.API, mGamesApiOptions);
        } else {
            builder.addApi(Games.API);
        }

        builder.addScope(Games.SCOPE_GAMES);
    }

    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        if (mPlusApiOptions != null) {
            builder.addApi(Plus.API, mPlusApiOptions);
        } else {
            builder.addApi(Plus.API);
        }
        builder.addScope(Plus.SCOPE_PLUS_LOGIN);
    }

    if (0 != (mRequestedClients & CLIENT_APPSTATE)) {
        builder.addApi(AppStateManager.API);
        builder.addScope(AppStateManager.SCOPE_APP_STATE);
    }

    mGoogleApiClientBuilder = builder;
    return builder;
}
 
开发者ID:googlesamples,项目名称:io2014-codelabs,代码行数:45,代码来源:GameHelper.java


示例13: createApiClientBuilder

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
/**
 * Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally,
 * you do not have to do this; use this method only if you need to make
 * nonstandard setup (e.g. adding extra scopes for other APIs) on the
 * GoogleApiClient.Builder before calling @link{#setup}.
 */
public GoogleApiClient.Builder createApiClientBuilder() {
    if (mSetupDone) {
        String error = "GameHelper: you called GameHelper.createApiClientBuilder() after "
                + "calling setup. You can only get a client builder BEFORE performing setup.";
        logError(error);
        throw new IllegalStateException(error);
    }

    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(
            mActivity, this, this);

    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        builder.addApi(Games.API, mGamesApiOptions);
        builder.addScope(Games.SCOPE_GAMES);
    }

    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        builder.addApi(Plus.API);
        builder.addScope(Plus.SCOPE_PLUS_LOGIN);
    }

    if (0 != (mRequestedClients & CLIENT_APPSTATE)) {
        builder.addApi(AppStateManager.API);
        builder.addScope(AppStateManager.SCOPE_APP_STATE);
    }

    if (0 != (mRequestedClients & CLIENT_SNAPSHOT)) {
        throw new IllegalArgumentException("Client Snapshot is not available in GooglePlayServices-OpenFL");
      /*builder.addScope(Drive.SCOPE_APPFOLDER);
      builder.addApi(Drive.API);*/
    }

    mGoogleApiClientBuilder = builder;
    return builder;
}
 
开发者ID:CharcoalStyles,项目名称:GooglePlayServices-OpenFL,代码行数:42,代码来源:GameHelper.java


示例14: createApiClientBuilder

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
/**
 * Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally,
 * you do not have to do this; use this method only if you need to make
 * nonstandard setup (e.g. adding extra scopes for other APIs) on the
 * GoogleApiClient.Builder before calling @link{#setup}.
 */
public GoogleApiClient.Builder createApiClientBuilder() {
    if (mSetupDone) {
        String error = "GameHelper: you called GameHelper.createApiClientBuilder() after "
                + "calling setup. You can only get a client builder BEFORE performing setup.";
        logError(error);
        throw new IllegalStateException(error);
    }

    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(
            mActivity, this, this);

    if (0 != (mRequestedClients & CLIENT_GAMES)) {
        builder.addApi(Games.API, mGamesApiOptions);
        builder.addScope(Games.SCOPE_GAMES);
    }

    if (0 != (mRequestedClients & CLIENT_PLUS)) {
        builder.addApi(Plus.API);
        builder.addScope(Plus.SCOPE_PLUS_LOGIN);
    }

    if (0 != (mRequestedClients & CLIENT_APPSTATE)) {
        builder.addApi(AppStateManager.API);
        builder.addScope(AppStateManager.SCOPE_APP_STATE);
    }

    mGoogleApiClientBuilder = builder;
    return builder;
}
 
开发者ID:dan-zx,项目名称:tedroid,代码行数:36,代码来源:GameHelper.java


示例15: onResult

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
@Override
public void onResult(AppStateManager.StateResult result) {
    AppStateManager.StateConflictResult conflictResult = result.getConflictResult();
    AppStateManager.StateLoadedResult loadedResult = result.getLoadedResult();
    if (loadedResult != null) {
        processStateLoaded(loadedResult);
    } else if (conflictResult != null) {
        processStateConflict(conflictResult);
    }
}
 
开发者ID:spdd,项目名称:chessonline,代码行数:11,代码来源:DroidFish.java


示例16: saveToCloud

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
void saveToCloud() {
  	if (mClient.isConnected()) {
  		mSaveGame.setUserName(Games.Players.getCurrentPlayer(getApiClient()).getDisplayName());
          AppStateManager.update(mClient, OUR_STATE_KEY, mSaveGame.toBytes());
          //Toast.makeText(getApplicationContext(), "���������� � ������ ����� ������� 1: " + new String(mSaveGame.toBytes()), Toast.LENGTH_SHORT).show();
} else {

}

      // Note: this is a fire-and-forget call. It will NOT trigger a call to any callbacks!
  }
 
开发者ID:spdd,项目名称:chessonline,代码行数:12,代码来源:DroidFish.java


示例17: processStateConflict

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
private void processStateConflict(AppStateManager.StateConflictResult result) {
    // Need to resolve conflict between the two states.
    // We do that by taking the union of the two sets of cleared levels,
    // which means preserving the maximum star rating of each cleared
    // level:
    byte[] serverData = result.getServerData();
    byte[] localData = result.getLocalData();

    SaveGame localGame = new SaveGame(localData);
    SaveGame serverGame = new SaveGame(serverData);
    SaveGame resolvedGame = localGame.unionWith(serverGame);

    AppStateManager.resolve(mClient, result.getStateKey(), result.getResolvedVersion(),
            resolvedGame.toBytes()).setResultCallback(mResultCallback);
}
 
开发者ID:spdd,项目名称:chessonline,代码行数:16,代码来源:DroidFish.java


示例18: processStateLoaded

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
private void processStateLoaded(AppStateManager.StateLoadedResult result) {
    switch (result.getStatus().getStatusCode()) {
    case AppStateStatusCodes.STATUS_OK:
        // Data was successfully loaded from the cloud: merge with local data.
        mSaveGame = mSaveGame.unionWith(new SaveGame(result.getLocalData()));
        mAlreadyLoadedState = true;
        saveLocal();
        //Toast.makeText(getApplicationContext(), "�������� �� ������ �������: " + new String(result.getLocalData()), Toast.LENGTH_SHORT).show();
        //hideAlertBar();
        break;
    case AppStateStatusCodes.STATUS_STATE_KEY_NOT_FOUND:
        // key not found means there is no saved data. To us, this is the same as
        // having empty data, so we treat this as a success.
        mAlreadyLoadedState = true;
        //hideAlertBar();
        break;
    case AppStateStatusCodes.STATUS_NETWORK_ERROR_NO_DATA:
        // can't reach cloud, and we have no local state. Warn user that
        // they may not see their existing progress, but any new progress won't be lost.
        //showAlertBar(R.string.no_data_warning);
        break;
    case AppStateStatusCodes.STATUS_NETWORK_ERROR_STALE_DATA:
        // can't reach cloud, but we have locally cached data.
        //showAlertBar(R.string.stale_data_warning);
        break;
    case AppStateStatusCodes.STATUS_CLIENT_RECONNECT_REQUIRED:
        // need to reconnect AppStateClient
        reconnectClient();
        break;
    default:
        // error
        //showAlertBar(R.string.load_error_warning);
        break;
    }

    updateRatingUi();
}
 
开发者ID:spdd,项目名称:chessonline,代码行数:38,代码来源:DroidFish.java


示例19: createApiClientBuilder

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
/**
 * Creates a GoogleApiClient.Builder for use with @link{#setup}. Normally,
 * you do not have to do this; use this method only if you need to make
 * nonstandard setup (e.g. adding extra scopes for other APIs) on the
 * GoogleApiClient.Builder before calling @link{#setup}.
 */
public GoogleApiClient.Builder createApiClientBuilder() {
  if (mSetupDone) {
    String error = "GameHelper: you called GameHelper.createApiClientBuilder() after "
        + "calling setup. You can only get a client builder BEFORE performing setup.";
    logError(error);
    throw new IllegalStateException(error);
  }

  GoogleApiClient.Builder builder = new GoogleApiClient.Builder(
      mActivity, this, this);

  if (0 != (mRequestedClients & CLIENT_GAMES)) {
    builder.addApi(Games.API, mGamesApiOptions);
    builder.addScope(Games.SCOPE_GAMES);
  }

  if (0 != (mRequestedClients & CLIENT_PLUS)) {
    builder.addApi(Plus.API);
    builder.addScope(Plus.SCOPE_PLUS_LOGIN);
  }

  if (0 != (mRequestedClients & CLIENT_APPSTATE)) {
    builder.addApi(AppStateManager.API);
    builder.addScope(AppStateManager.SCOPE_APP_STATE);
  }

  if (0 != (mRequestedClients & CLIENT_SNAPSHOT)) {
    builder.addScope(Drive.SCOPE_APPFOLDER);
    builder.addApi(Drive.API);
  }

  mGoogleApiClientBuilder = builder;
  return builder;
}
 
开发者ID:alcacoop,项目名称:it.alcacoop.fourinaline,代码行数:41,代码来源:GServiceGameHelper.java


示例20: score

import com.google.android.gms.appstate.AppStateManager; //导入依赖的package包/类
private void score(final String id) {

        if(id.equals(Plus.PeopleApi.getCurrentPerson(getGoogleApiClient()).getId())) {
            Toast.makeText(this, R.string.arrow_selfie, Toast.LENGTH_LONG).show();
            return;
        }

        AppStateManager.load(getGoogleApiClient(), Const.ARROW_DONE_STATE_KEY).setResultCallback(new ResultCallback<AppStateManager.StateResult>() {
            @Override
            public void onResult(AppStateManager.StateResult stateResult) {
                AppStateManager.StateConflictResult conflictResult
                        = stateResult.getConflictResult();
                AppStateManager.StateLoadedResult loadedResult
                        = stateResult.getLoadedResult();

                if (loadedResult != null) {
                    if(loadedResult.getStatus().getStatusCode() == AppStateStatusCodes.STATUS_OK || loadedResult.getStatus().getStatusCode() == AppStateStatusCodes.STATUS_STATE_KEY_NOT_FOUND) {
                        previous = "";

                        if (loadedResult.getStatus().getStatusCode() == AppStateStatusCodes.STATUS_OK) {
                            previous = new String(loadedResult.getLocalData());

                            if (previous.contains(id)) {
                                Toast.makeText(ArrowActivity.this, R.string.arrow_already_tagged, Toast.LENGTH_LONG).show();
                            } else {
                                addTaggedPersonToCloudSave(id);
                            }
                        } else {
                            addTaggedPersonToCloudSave(id);
                        }
                    } else {

                    }
                } else if (conflictResult != null) {
                    previous = mergeIds(new String(conflictResult.getLocalData()), new String(conflictResult.getServerData()));

                    if (previous.contains(id)) {
                        Toast.makeText(ArrowActivity.this, R.string.arrow_already_tagged, Toast.LENGTH_LONG).show();
                    } else {
                        addTaggedPersonToCloudSave(id);
                    }

                    Toast.makeText(ArrowActivity.this, getString(R.string.arrow_oops), Toast.LENGTH_LONG).show();
                }
            }
        });
    }
 
开发者ID:gdgjodhpur,项目名称:gdgapp,代码行数:48,代码来源:ArrowActivity.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java VCFCodec类代码示例发布时间:2022-05-21
下一篇:
Java TileEntityBanner类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap