java.lang.Object | ||||||
↳ | java.util.AbstractMap<K, V> | |||||
↳ | com.google.api.client.util.GenericData | |||||
↳ | com.google.api.client.json.GenericJson | |||||
↳ | com.kinvey.java.User<T extends com.kinvey.java.User> | |||||
↳ | com.kinvey.android.AbstractAsyncUser<T extends com.kinvey.java.User> | |||||
↳ | com.kinvey.android.AsyncUser<T extends com.kinvey.java.User> |
Wraps the User
public methods in asynchronous functionality using native Android AsyncTask.
This functionality can be accessed through the user()
convenience method.
Methods in this API use either KinveyUserCallback
for authentication, login, and
user creation, or the general-purpose KinveyClientCallback
used for User data retrieval,
updating, and management.
Login sample:
public void submit(View view) {
kinveyClient.user().login(mEditUserName.getText().toString(), mEditPassword.getText().toString(),
new KinveyUserCallback() {
public void onFailure(Throwable t) {
CharSequence text = "Wrong username or password.";
Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT).show();
public void onSuccess(User u) {
CharSequence text = "Welcome back," + u.getUsername() + ".";
Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT).show();
LoginActivity.this.startActivity(new Intent(LoginActivity.this,
SessionsActivity.class));
LoginActivity.this.finish();
}
});
}
Saving user data sample:
User user = kinveyClient.user();
user.put("fav_food", "bacon");
user.update(new KinveyClientCallback<User.Update>() {
public void onFailure(Throwable e) { ...
public void onSuccess(User u) { ... }
});
}
This class is not thread-safe.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AsyncUser(AbstractClient client, Class<T> userClass, KinveyAuthRequest.Builder builder)
Base constructor requires the client instance and a com.kinvey.java.auth.KinveyAuthRequest.Builder to be passed in.
| |||||||||||
AsyncUser() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Base constructor requires the client instance and a com.kinvey.java.auth.KinveyAuthRequest.Builder to be passed in.
initializeRequest(com.kinvey.java.core.AbstractKinveyClientRequest)
is used to initialize all
requests constructed by this api.
client | instance of current client |
---|
NullPointerException | if the client parameter and KinveyAuthRequest.Builder is non-null |
---|