Java 类com.google.android.gms.wearable.DataApi.DataItemResult 实例源码

项目:AndroidWearable-Samples    文件:MainActivity.java   
@Override
public void run() {
    PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(COUNT_PATH);
    putDataMapRequest.getDataMap().putInt(COUNT_KEY, count++);
    PutDataRequest request = putDataMapRequest.asPutDataRequest();

    LOGD(TAG, "Generating DataItem: " + request);
    if (!mGoogleApiClient.isConnected()) {
        return;
    }
    Wearable.DataApi.putDataItem(mGoogleApiClient, request)
            .setResultCallback(new ResultCallback<DataItemResult>() {
                @Override
                public void onResult(DataItemResult dataItemResult) {
                    if (!dataItemResult.getStatus().isSuccess()) {
                        Log.e(TAG, "ERROR: failed to putDataItem, status code: "
                                + dataItemResult.getStatus().getStatusCode());
                    }
                }
            });
}
项目:AndroidWearable-Samples    文件:MainActivity.java   
/**
 * Sends the asset that was created form the photo we took by adding it to the Data Item store.
 */
private void sendPhoto(Asset asset) {
    PutDataMapRequest dataMap = PutDataMapRequest.create(IMAGE_PATH);
    dataMap.getDataMap().putAsset(IMAGE_KEY, asset);
    dataMap.getDataMap().putLong("time", new Date().getTime());
    PutDataRequest request = dataMap.asPutDataRequest();
    Wearable.DataApi.putDataItem(mGoogleApiClient, request)
            .setResultCallback(new ResultCallback<DataItemResult>() {
                @Override
                public void onResult(DataItemResult dataItemResult) {
                    LOGD(TAG, "Sending image was successful: " + dataItemResult.getStatus()
                            .isSuccess());
                }
            });

}
项目:GetSensorData    文件:MainActivity.java   
@Override
public void run() {
    //不断发送int数据
    if(btn_startSensor.getText().toString().equals("停止采集")){
        PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(COUNT_PATH);
        putDataMapRequest.getDataMap().putInt(COUNT_KEY, count++);
        PutDataRequest request = putDataMapRequest.asPutDataRequest();

        LOGD(TAG, "Generating DataItem: " + request);
        if (!mGoogleApiClient.isConnected()) {
            return;
        }
        Wearable.DataApi.putDataItem(mGoogleApiClient, request)
                .setResultCallback(new ResultCallback<DataItemResult>() {
                    @Override
                    public void onResult(DataItemResult dataItemResult) {
                        if (!dataItemResult.getStatus().isSuccess()) {
                            Log.e(TAG, "ERROR: failed to putDataItem, status code: "
                                    + dataItemResult.getStatus().getStatusCode());
                        }
                    }
                });
    }

}
项目:GetSensorData    文件:MainActivity.java   
/**
 * Sends the asset that was created form the photo we took by adding it to the Data Item store.
 */
private void sendPhoto(Asset asset) {
    PutDataMapRequest dataMap = PutDataMapRequest.create(IMAGE_PATH);
    dataMap.getDataMap().putAsset(IMAGE_KEY, asset);
    dataMap.getDataMap().putLong("time", new Date().getTime());
    PutDataRequest request = dataMap.asPutDataRequest();
    Wearable.DataApi.putDataItem(mGoogleApiClient, request)
            .setResultCallback(new ResultCallback<DataItemResult>() {
                @Override
                public void onResult(DataItemResult dataItemResult) {
                    LOGD(TAG, "Sending image was successful: " + dataItemResult.getStatus()
                            .isSuccess());
                }
            });

}
项目:fantasywear    文件:DemoActivity.java   
private void onLogoFetchComplete() {
    if (mLogo == null || mOppLogo == null) {
        return;
    }
    League league = new League.Builder()
            .account_name(DEMO_ACCOUNT.name)
            .league_key(DEMO_LEAGUE_KEY)
            .build();
    Matchup matchup = new Matchup.Builder()
            .my_team(new Team.Builder()
                    .score(mScore.getText().toString())
                    .build())
            .opponent_team(new Team.Builder()
                    .name(mOppName.getText().toString())
                    .score(mOppScore.getText().toString())
                    .build())
            .build();
    PutDataRequest request = LeagueData.getUpdateRequest(DEMO_ACCOUNT, league, matchup,
            SyncAdapter.getLogoAssetForBitmap(mLogo, mLogoSize),
            SyncAdapter.getLogoAssetForBitmap(mOppLogo, mLogoSize), true);
    Wearable.DataApi
            .putDataItem(mGoogleApiClient, request)
            .setResultCallback(new ResultCallback<DataItemResult>() {
                @Override
                public void onResult(DataItemResult dataItemResult) {
                    Toast.makeText(DemoActivity.this, "Demo league pushed", Toast.LENGTH_SHORT)
                            .show();
                }
            });
    mLogo = null;
    mOppLogo = null;
}
项目:fantasywear    文件:SyncAdapter.java   
private static void sendUpdateToWear(GoogleApiClient googleApiClient, Account account,
        League league, Matchup matchup, Asset logo, Asset oppLogo, boolean forceUpdate)
        throws IOException {
    PutDataRequest request = LeagueData.getUpdateRequest(account, league, matchup,
            logo, oppLogo, forceUpdate);
    DataItemResult result = Wearable.DataApi
            .putDataItem(googleApiClient, request)
            .await(Constants.GOOGLE_API_CLIENT_TIMEOUT_SEC, TimeUnit.SECONDS);
    if (!result.getStatus().isSuccess()) {
        throw new IOException("Failed to send new scores to Wear, status = "
                + result.getStatus());
    }
}
项目:FMTech    文件:zzcd.java   
public zzr(zzmu.zzb<DataApi.DataItemResult> paramzzb)
{
  super();
}
项目:FMTech    文件:zzcd.java   
zzy(zzmu.zzb<DataApi.DataItemResult> paramzzb, List<FutureTask<Boolean>> paramList)
{
  super();
  this.zzzM = paramList;
}
项目:FMTech    文件:zzx.java   
public final PendingResult<DataApi.DataItemResult> getDataItem(GoogleApiClient paramGoogleApiClient, final Uri paramUri)
{
  paramGoogleApiClient.zza(new zzi(paramGoogleApiClient) {});
}
项目:FMTech    文件:zzx.java   
public final PendingResult<DataApi.DataItemResult> putDataItem(GoogleApiClient paramGoogleApiClient, final PutDataRequest paramPutDataRequest)
{
  paramGoogleApiClient.zza(new zzi(paramGoogleApiClient) {});
}