I created an azure mobile service and set up all the database tables properly (tested them). However when I try to insert a record to my SQL table through my android app, the record doesn't get added. (Yes my SQL table is ready for the mobile service as well. Changed the Schema as well)
I don't get an error either.
Here's my code:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_screen);
final String mobileServiceUrl =
"https://MY_AZURE_MOBILE_URL.net/tables/UserTable";
final String mobileServiceAppId =
"MY_MOBILESERVICE_APPID";
try {
// Create the Mobile Service Client instance, using the provided
// Mobile Service URL and key
mClient = new MobileServiceClient(
mobileServiceUrl,
mobileServiceAppId,
this);
// Get the Mobile Service Table instance to use
mToDoTable = mClient.getTable(UserTable.class);
} catch (MalformedURLException e) {
}
Button regiBtn = (Button) findViewById(R.id.signupDivertBtn);
regiBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try
{
UserTable user = new UserTable();
user.setPassword("111");
user.setFname("TESTName");
user.setId("234232");
user.setEmail("[email protected]");
mToDoTable.insert(user);
}
Why doesn't the mToDoTable.Insert() statement work? Is it not the right way to insert a record to an azure table?
EDIT:
Here's my UserTable Entity class:
public class UserTable {
@com.google.gson.annotations.SerializedName("id")
private String id;
@com.google.gson.annotations.SerializedName("Email")
private String email;
@com.google.gson.annotations.SerializedName("Password")
private String password;
@com.google.gson.annotations.SerializedName("UserFName")
private String fname;
public UserTable()
{
}
public UserTable(String id, String email, String password, String fname) {
this.setId(id);
this.setEmail(email);
this.setPassword(password);
this.setFname(fname);
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getFname() {
return fname;
}
public void setFname(String fname) {
this.fname = fname;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}