I am using Google Mobile Backend Starter. I am trying to write a user id in a CloudEntity object with .setId, but when I try to write it to the data store using the CloudBackend.insert method. It only writes properties, but does not include my user id.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
mTrackButton = (Button) findViewById(R.id.trackButton);
mTrackButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendData();
}
});
}
private void sendData(){
CloudEntity ce = new CloudEntity("Try");
ce.setId("Custom_ID");
ce.put("Key1", "Value1");
CloudCallbackHandler<CloudEntity> cch = new CloudCallbackHandler<CloudEntity>() {
@Override
public void onComplete(CloudEntity results) {
Toast.makeText(TestActivity.this, "Sent to cloud", Toast.LENGTH_SHORT).show();
}
@Override
public void onError(IOException e) {
Toast.makeText(TestActivity.this, e.toString(), Toast.LENGTH_SHORT).show();
}
};
getCloudBackend().insert(ce,cch);
}

Am I doing something wrong?
source
share