As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
final Client kinveyClient = new Client.Builder(this).build();
kinveyClient.user().logout().execute();
kinveyClient.user().login(email, password, new KinveyUserCallback() {
public void onSuccess(User user) {
Toast.makeText(LoginActivity.this, "Username=" + kinveyClient.user().getUsername() + "/Logged in=" + kinveyClient.user().isUserLoggedIn(), Toast.LENGTH_LONG).show();
}
@Override
public void onFailure(Throwable throwable) {}
});
displays Username=email@email.com/Logged in=true
If I use a new kinveyClient :
final Client kinveyClient = new Client.Builder(this).build();
kinveyClient.user().logout().execute();
kinveyClient.user().login(email, password, new KinveyUserCallback() {
public void onSuccess(User user) {
final Client kinveyClient2 = new Client.Builder(LoginActivity.this).build();
Toast.makeText(LoginActivity.this, "Username=" + kinveyClient2.user().getUsername() + "/Logged in=" + kinveyClient2.user().isUserLoggedIn(), Toast.LENGTH_LONG).show();
}
@Override
public void onFailure(Throwable throwable) {}
});
displays Username=null/Logged in=true
Could you explain me why the username is null while the user is logged in ?
Best Answer
D
Damien Bell
said
about 8 years ago
Fabreax,
It seems as though I've mislead you! You can actually have both logged in at the same time, what's happening here is actually a bit different. You are being tricked. Your login call with client2 has all the credentials (as the ID / Auth token are stored on disk) so the call seems to happen without network activity, but all the other information requires an update from the server, which is an asynchronous call.
You can use something like the following to help you out:
final Client kinveyClient2 = new Client.Builder(this).setRetrieveUserCallback(new KinveyUserCallback(){...}).build()
Hopefully this helps. Sorry about the misleading first reply.
To my knowledge you can only have 1 session per logged in user, another call to login will assume that you want to logout the user from their existing session.
Let me double-check this functionality with Ed.
Thanks,
f
fabreax
said
about 8 years ago
Thanks ! It's curious to have a user logged in without a username.
Damien Bell
said
about 8 years ago
Answer
Fabreax,
It seems as though I've mislead you! You can actually have both logged in at the same time, what's happening here is actually a bit different. You are being tricked. Your login call with client2 has all the credentials (as the ID / Auth token are stored on disk) so the call seems to happen without network activity, but all the other information requires an update from the server, which is an asynchronous call.
You can use something like the following to help you out:
final Client kinveyClient2 = new Client.Builder(this).setRetrieveUserCallback(new KinveyUserCallback(){...}).build()
Hopefully this helps. Sorry about the misleading first reply.
1 person likes this
f
fabreax
said
about 8 years ago
Thanks Damien !
The kinvey doc about the "Client" class is explicit :
It is recommended to maintain a single instance of a Client while developing with Kinvey, either in an Activity, a Service, or an Application.
I was creating a new client. Since I'm now using only one kinvey Client (using a Singleton), I have no issue.
fabreax
Hi,
I have a behaviour that I don't understand :
displays Username=email@email.com/Logged in=true
If I use a new kinveyClient :
displays Username=null/Logged in=true
Could you explain me why the username is null while the user is logged in ?
Fabreax,
It seems as though I've mislead you! You can actually have both logged in at the same time, what's happening here is actually a bit different. You are being tricked. Your login call with client2 has all the credentials (as the ID / Auth token are stored on disk) so the call seems to happen without network activity, but all the other information requires an update from the server, which is an asynchronous call.
You can use something like the following to help you out:
final Client kinveyClient2 = new Client.Builder(this).setRetrieveUserCallback(new KinveyUserCallback(){...}).build()
Hopefully this helps. Sorry about the misleading first reply.
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstDamien Bell
To my knowledge you can only have 1 session per logged in user, another call to login will assume that you want to logout the user from their existing session.
Let me double-check this functionality with Ed.
Thanks,
fabreax
Thanks ! It's curious to have a user logged in without a username.
Damien Bell
Fabreax,
It seems as though I've mislead you! You can actually have both logged in at the same time, what's happening here is actually a bit different. You are being tricked. Your login call with client2 has all the credentials (as the ID / Auth token are stored on disk) so the call seems to happen without network activity, but all the other information requires an update from the server, which is an asynchronous call.
You can use something like the following to help you out:
final Client kinveyClient2 = new Client.Builder(this).setRetrieveUserCallback(new KinveyUserCallback(){...}).build()
Hopefully this helps. Sorry about the misleading first reply.
1 person likes this
fabreax
Thanks Damien !
The kinvey doc about the "Client" class is explicit :
I was creating a new client. Since I'm now using only one kinvey Client (using a Singleton), I have no issue.
-
Can I add KinveyReferences and other custom Arrays to the User entity?
-
How can I use custom enums within my Entity?
-
Linking an image does not save with LinkedData
-
How can I get all records saved by the current user?
-
Why don't all users see the same data when querying?
-
Retrieving related file from datastore collection - continued
-
Problem implementing sign up / login
-
Can Android API be used for Java?
-
I'm not receiving push notifications
-
It is impossible to receive object according to the link
See all 259 topics