|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectcom.parse.ParseObject
com.parse.ParseUser
public class ParseUser
Constructor Summary | |
---|---|
ParseUser()
Constructs a new ParseUser with no data in it. |
Method Summary | |
---|---|
static void |
enableAutomaticUser()
Enables automatic creation of anonymous users. |
ParseUser |
fetch()
Fetches this object with the data from the server. |
ParseUser |
fetchIfNeeded()
If this ParseObject has not been fetched (i.e. |
static ParseUser |
getCurrentUser()
This retrieves the currently logged in ParseUser with a valid session, either from memory or disk if necessary. |
String |
getEmail()
Retrieves the email address. |
static ParseQuery<ParseUser> |
getQuery()
Constructs a query for ParseUsers. |
String |
getSessionToken()
Retrieves the session token for a user, if they are logged in. |
String |
getUsername()
Retrieves the username. |
boolean |
isAuthenticated()
Whether the ParseUser has been authenticated on this device. |
boolean |
isNew()
Indicates whether this ParseUser was created during this session through a call to
ParseUser.signUp() or by logging in with a linked service such as Facebook. |
static ParseUser |
logIn(String username,
String password)
Logs in a user with a username and password. |
static void |
logInInBackground(String username,
String password,
LogInCallback callback)
Logs in a user with a username and password. |
static void |
logOut()
Logs out the currently logged in user session. |
void |
put(String key,
Object value)
Add a key-value pair to this object. |
void |
remove(String key)
Removes a key from this object's data if it exists. |
static void |
requestPasswordReset(String email)
Requests a password reset email to be sent to the specified email address associated with the user account. |
static void |
requestPasswordResetInBackground(String email,
RequestPasswordResetCallback callback)
Requests a password reset email to be sent in a background thread to the specified email address associated with the user account. |
void |
setEmail(String email)
Sets the email address. |
void |
setPassword(String password)
Sets the password. |
void |
setUsername(String username)
Sets the username. |
void |
signUp()
Signs up a new user. |
void |
signUpInBackground(SignUpCallback callback)
Signs up a new user. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ParseUser()
ParseUser.signUp()
is called.
Method Detail |
---|
public boolean isAuthenticated()
public void remove(String key)
ParseObject
remove
in class ParseObject
key
- The key to remove.public void setUsername(String username)
username
- The username to set.public String getUsername()
public void setPassword(String password)
password
- The password to set.public void setEmail(String email)
email
- The email address to set.public String getEmail()
public void put(String key, Object value)
ParseObject
put
in class ParseObject
key
- Keys must be alphanumerical plus underscore, and start with a letter.value
- Values may be numerical, String, JSONObject, JSONArray, JSONObject.NULL, or other
ParseObjects. value may not be null
.public String getSessionToken()
public ParseUser fetch() throws ParseException
ParseObject
fetch
in class ParseObject
ParseException
- Throws an exception if the server is inaccessible.public void signUp() throws ParseException
ParseObject.save()
for new ParseUsers. This
will create a new ParseUser on the server, and also persist the session on disk so that you can
access the user using ParseUser.getCurrentUser()
.
A username and password must be set before calling signUp.
Typically, you should use ParseUser.signUpInBackground(com.parse.SignUpCallback)
instead of this, unless you are managing
your own threading.
ParseException
- Throws an exception if the server is inaccessible, or if the username has already
been taken.public void signUpInBackground(SignUpCallback callback)
ParseObject.save()
for new ParseUsers. This
will create a new ParseUser on the server, and also persist the session on disk so that you can
access the user using ParseUser.getCurrentUser()
.
A username and password must be set before calling signUp.
This is preferable to using ParseUser.signUp()
, unless your code is already running from a
background thread.
callback
- callback.done(user, e) is called when the signUp completes.
ParseException
- Throws an exception if the server is inaccessible, or if the username has already
been taken.public static ParseUser logIn(String username, String password) throws ParseException
ParseUser.getCurrentUser()
Typically, you should use ParseUser.logInInBackground(java.lang.String, java.lang.String, com.parse.LogInCallback)
instead of this, unless you are managing
your own threading.
username
- The username to log in with.password
- The password to log in with.
ParseException
- Throws an exception if the login was unsuccessful.public static void logInInBackground(String username, String password, LogInCallback callback)
ParseUser.getCurrentUser()
This is preferable to using ParseUser.logIn(java.lang.String, java.lang.String)
, unless your code is already running from a
background thread.
username
- The username to log in with.password
- The password to log in with.callback
- callback.done(user, e) is called when the login completes.public static ParseUser getCurrentUser()
public static void logOut()
ParseUser.getCurrentUser()
will return null.
public static void requestPasswordReset(String email) throws ParseException
Typically, you should use ParseUser.requestPasswordResetInBackground(java.lang.String, com.parse.RequestPasswordResetCallback)
instead of this, unless you
are managing your own threading.
email
- The email address associated with the user that forgot their password.
ParseException
- Throws an exception if the server is inaccessible, or if an account with that email
doesn't exist.public static void requestPasswordResetInBackground(String email, RequestPasswordResetCallback callback)
This is preferable to using requestPasswordReset(), unless your code is already running from a background thread.
email
- The email address associated with the user that forgot their password.callback
- callback.done(e) is called when the request completes.public ParseUser fetchIfNeeded() throws ParseException
ParseObject
ParseObject.isDataAvailable()
returns false),
fetches this object with the data from the server.
fetchIfNeeded
in class ParseObject
ParseException
- Throws an exception if the server is inaccessible.public boolean isNew()
ParseUser
was created during this session through a call to
ParseUser.signUp()
or by logging in with a linked service such as Facebook.
public static void enableAutomaticUser()
ParseUser.getCurrentUser()
will always have a value. The user will only be created on
the server once the user has been saved, or once an object with a relation to that user or an
ACL that refers to the user has been saved. Note: saveEventually will not work if an item being
saved has a relation to an automatic user that has never been saved.
public static ParseQuery<ParseUser> getQuery()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |