public class

AsyncUser

extends AbstractAsyncUser<T extends User>
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>

Class Overview

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.

Summary

[Expand]
Inherited Constants
From class com.kinvey.java.User
[Expand]
Inherited Fields
From class com.kinvey.java.User
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
From class com.kinvey.android.AbstractAsyncUser
From class com.kinvey.java.User
From class com.google.api.client.json.GenericJson
From class com.google.api.client.util.GenericData
From class java.util.AbstractMap
From class java.lang.Object
From interface java.util.Map

Public Constructors

public 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.

initializeRequest(com.kinvey.java.core.AbstractKinveyClientRequest) is used to initialize all requests constructed by this api.

Parameters
client instance of current client
Throws
NullPointerException if the client parameter and KinveyAuthRequest.Builder is non-null

public AsyncUser ()