本文整理汇总了Java中com.google.android.gms.appstate.AppStateClient.STATUS_INTERNAL_ERROR属性的典型用法代码示例。如果您正苦于以下问题:Java AppStateClient.STATUS_INTERNAL_ERROR属性的具体用法?Java AppStateClient.STATUS_INTERNAL_ERROR怎么用?Java AppStateClient.STATUS_INTERNAL_ERROR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.android.gms.appstate.AppStateClient
的用法示例。
在下文中一共展示了AppStateClient.STATUS_INTERNAL_ERROR属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onStateDeleted
@Override
public void onStateDeleted(int statusCode, int stateKey){
JSONObject json = new JSONObject();
try{
json.put("type", STATE_CONFLICTED);
json.put("statusCode", statusCode);
json.put("stateKey", stateKey);
switch (statusCode) {
case AppStateClient.STATUS_OK:
// if data was successfully deleted from the server.
break;
case AppStateClient.STATUS_INTERNAL_ERROR:
// if an unexpected error occurred in the service
break;
case AppStateClient.STATUS_NETWORK_ERROR_OPERATION_FAILED:
// if the device was unable to communicate with the network. In this case, the operation is not retried automatically.
break;
case AppStateClient.STATUS_CLIENT_RECONNECT_REQUIRED:
// need to reconnect AppStateClient
mHelper.reconnectClients(clientTypes);
break;
default:
// error
break;
}
}catch(JSONException ex){
Log.e(TAG, "STATE_DELETED ["+statusCode+"] ["+stateKey+"] exception: "+ex.getMessage());
return;
}
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, json);
pluginResult.setKeepCallback(true);
connectionCB.sendPluginResult(pluginResult);
}
示例2: onStateLoaded
@Override
public void onStateLoaded(int statusCode, int stateKey, byte[] localData) {
JSONObject json = new JSONObject();
try{
json.put("type", STATE_LOADED);
json.put("status", statusCode);
switch (statusCode) {
case AppStateClient.STATUS_OK:
// Data was successfully loaded from the cloud: merge with local data.
json.put("stateKey", stateKey);
json.put("data", new String(localData));
break;
case AppStateClient.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.
break;
case AppStateClient.STATUS_STATE_KEY_LIMIT_EXCEEDED:
// if the application already has data present in the maximum number of state keys.
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_LOADED ["+statusCode+"] ["+stateKey+"] exception: "+ex.getMessage());
return;
}
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, json);
pluginResult.setKeepCallback(true);
connectionCB.sendPluginResult(pluginResult);
}
示例3: onStateListLoaded
@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);
}