i have enabled the stay logged in and works fine but when i update the entry in users table using following code
SharedPreferences prefs = getSharedPreferences(“MyPref”, MODE_PRIVATE);
String email = prefs.getString(“email”, null);
String password = prefs.getString(“pwd”, null);
// Toast.makeText(Account_Edit.this, email+" , "+password, Toast.LENGTH_LONG).show();
if (isAccEditValuesValid(mobile, dob, address, city, pincode)) {
final ProgressDialog mProgressDialog;
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setCancelable(false);
mProgressDialog.setMessage(“Updating Info…”);
mProgressDialog.show();
Backendless.UserService.login( email, password, new AsyncCallback<BackendlessUser>()
{
public void handleResponse( BackendlessUser user )
{
// user has been logged in, now user properties can be updated
user.setProperty( "address", address.toString() );
user.setProperty( "city", city.toString() );
user.setProperty( "dob", dob.toString() );
user.setProperty( "pincode", pincode.toString() );
user.setProperty( "mobile", mobile.toString() );
Backendless.UserService.update( user, new AsyncCallback<BackendlessUser>()
{
public void handleResponse( BackendlessUser user )
{
if(parent_activity==null) {
Intent homescreen_redirect = new Intent(Account_Edit.this, HomeScreen.class);
finish();
mProgressDialog.hide();
startActivity(homescreen_redirect);
overridePendingTransition(R.anim.pull_in_right, R.anim.push_out_left);
//Toast.makeText(Account_Edit.this, "case 1", Toast.LENGTH_LONG).show();
}else if(parent_activity!=null){
Intent review_callback = new Intent(getBaseContext(), Review_order.class);
review_callback.putExtra("address" , address.toString());
review_callback.putExtra("city" , city.toString());
review_callback.putExtra("pincode" , pincode.toString());
review_callback.putExtra("mobile" , mobile.toString());
mProgressDialog.hide();
setResult(Review_order.RESULT_OK, review_callback);
finish();
//Toast.makeText(Account_Edit.this, "case 2", Toast.LENGTH_LONG).show();
}
}
public void handleFault( BackendlessFault fault )
{
Toast.makeText(Account_Edit.this, "Error 1 "+fault, Toast.LENGTH_LONG).show();
}
});
}
public void handleFault( BackendlessFault fault )
{
Toast.makeText(Account_Edit.this, "Error 2 "+fault, Toast.LENGTH_LONG).show();
}
});
}
i have to login again when i close app and open it again