I have this code in the business logic:
@Override
public void beforeLogout( RunnerContext context ) throws Exception
{
System.out.print(context.toString());
String whereClause = "objectId" + " = '" + context.getUserId() + "'";
BackendlessDataQuery query = new BackendlessDataQuery(whereClause);
BackendlessCollection users = Backendless.Data.of((Class)BackendlessUser.class).find(query);
if (users.getData().size() > 0) {
BackendlessUser user = (BackendlessUser) users.getData().get(0);
user.setProperty("currentDeviceId","");
Backendless.UserService.update(user, new AsyncCallback<BackendlessUser>() {
@Override
public void handleResponse(BackendlessUser backendlessUser) {
}
@Override
public void handleFault(BackendlessFault backendlessFault) {
}
});
}
}
The runner context (toString) when beforeLogout/afterLogout are invoked:
RunnerContext{missingProperties=null,
prematureResult=null,
eventContext=null,
AbstractContext{
appId='D058552D-B615-CA4C-FF72-XXXXXXXXXXX',
userId='null',
userToken='null',
userRoles=[NotAuthenticatedUser],
deviceType=ANDROID}}
How am I suppose to manage the user if the context does not contain any information regarding it?
This happens to both methods beforeLogout and afterLogout.