I need to init AppStateClient for using Cloud for save and load data. I do next:
public Constructor() {
(1) private GameHelper aHelper = new GameHelper(this);
(2) aHelper.setup(this, GameHelper.CLIENT_APPSTATE | GameHelper.CLIENT_GAMES);
(3) private AppStateClient mHelper = aHelper.getAppStateClient();
}
But in second string I always got NullPointerException. In GameHelper class from Goggle it crashes on:
mGamesClient = new GamesClient.Builder(getContext(), this, this)
.setGravityForPopups(Gravity.TOP | Gravity.CENTER_HORIZONTAL)
.setScopes(mScopes)
.create();
and on:
mAppStateClient = new AppStateClient.Builder(getContext(), this, this)
.setScopes(mScopes)
.create();
What I do wrong?
aHelper variable I using in my app for achievements and leaderboards too and all work fine.