本文整理汇总了Java中com.google.android.gms.appstate.AppStateBuffer类的典型用法代码示例。如果您正苦于以下问题:Java AppStateBuffer类的具体用法?Java AppStateBuffer怎么用?Java AppStateBuffer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AppStateBuffer类属于com.google.android.gms.appstate包,在下文中一共展示了AppStateBuffer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: d
import com.google.android.gms.appstate.AppStateBuffer; //导入依赖的package包/类
public d(Status paramDataHolder, DataHolder arg3)
{
super(paramDataHolder, localDataHolder);
Object localObject;
this.jY = localObject;
this.ka = new AppStateBuffer(localDataHolder);
}
示例2: f
import com.google.android.gms.appstate.AppStateBuffer; //导入依赖的package包/类
public f(int paramDataHolder, DataHolder arg3)
{
super(paramDataHolder, localDataHolder);
int i;
this.jZ = i;
this.jY = new Status(localDataHolder.getStatusCode());
this.ka = new AppStateBuffer(localDataHolder);
}
示例3: onStateListLoaded
import com.google.android.gms.appstate.AppStateBuffer; //导入依赖的package包/类
public void onStateListLoaded(int statusCode, AppStateBuffer buffer)
{
Log.i("trace", what + ": GooglePlayCallback.onStateListLoaded: " + statusCode);
for(AppState s : buffer)
{
String version = s.getLocalVersion();
int key = s.getKey();
GooglePlay.connectionCallback.call("addAppState",
new Object[] {key, version});
}
}
示例4: getStateBuffer
import com.google.android.gms.appstate.AppStateBuffer; //导入依赖的package包/类
public final AppStateBuffer getStateBuffer()
{
return this.ka;
}
示例5: onStateListLoaded
import com.google.android.gms.appstate.AppStateBuffer; //导入依赖的package包/类
@Override
public void onStateListLoaded(int statusCode, AppStateBuffer buffer) {
JSONObject json = new JSONObject();
try{
json.put("type", STATE_LIST_LOADED);
json.put("status", statusCode);
switch (statusCode) {
case AppStateClient.STATUS_OK:
JSONArray jsonStates = new JSONArray();
json.put("states", jsonStates);
AppState state;
JSONObject jsonState;
for(int i=0,l=buffer.getCount();i<l;i++){
state = buffer.get(i);
jsonState = new JSONObject();
if (state.hasConflict()){
jsonState.put("type", STATE_CONFLICTED);
jsonState.put("stateKey", state.getKey());
jsonState.put("version", state.getConflictVersion());
jsonState.put("localVersion", state.getLocalVersion());
jsonState.put("localData", new JSONObject(new String(state.getLocalData())));
jsonState.put("serverData", new JSONObject(new String(state.getConflictData())));
}else{
jsonState.put("type", STATE_LOADED);
jsonState.put("status", statusCode);
jsonState.put("stateKey", state.getKey());
jsonState.put("data", new JSONObject(new String(state.getLocalData())));
}
jsonStates.put(jsonState);
}
// Data was successfully loaded from the cloud: merge with local data.
break;
case AppStateClient.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.
break;
case AppStateClient.STATUS_NETWORK_ERROR_STALE_DATA:
// can't reach cloud, but we have locally cached data.
break;
case AppStateClient.STATUS_CLIENT_RECONNECT_REQUIRED:
// need to reconnect AppStateClient
mHelper.reconnectClients(clientTypes);
break;
case AppStateClient.STATUS_INTERNAL_ERROR:
// if an unexpected error occurred in the service.
break;
default:
// error
break;
}
}catch(JSONException ex){
Log.e(TAG, "STATE_LIST_LOADED ["+statusCode+"]["+buffer.getCount()+"] exception: "+ex.getMessage());
return;
}
buffer.close();
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, json);
pluginResult.setKeepCallback(true);
connectionCB.sendPluginResult(pluginResult);
}