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


Java AppStateManager类代码示例

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


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


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