public class MobileServiceClient
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
UTF8_ENCODING
UTF-8 encoding
|
Constructor and Description |
---|
MobileServiceClient(MobileServiceClient client)
Constructor for the MobileServiceClient
|
MobileServiceClient(java.lang.String appUrl,
java.lang.String appKey,
Context context)
Constructor for the MobileServiceClient
|
MobileServiceClient(java.net.URL appUrl,
java.lang.String appKey,
Context context)
Constructor for the MobileServiceClient
|
Modifier and Type | Method and Description |
---|---|
static com.google.gson.GsonBuilder |
createMobileServiceGsonBuilder()
Creates a GsonBuilder with custom serializers to use with Windows Azure
Mobile Services
|
java.lang.String |
getAppKey()
Returns the Mobile Service application key
|
java.net.URL |
getAppUrl()
Returns The Mobile Service URL
|
Context |
getContext()
Gets the Context object used to create the MobileServiceClient
|
MobileServiceUser |
getCurrentUser()
Returns the current authenticated user
|
com.google.gson.GsonBuilder |
getGsonBuilder()
Gets the GsonBuilder used to in JSON Serialization/Deserialization
|
ServiceFilter |
getServiceFilter()
Gets the ServiceFilter.
|
<E> MobileServiceTable<E> |
getTable(java.lang.Class<E> clazz)
Creates a MobileServiceTable
|
MobileServiceJsonTable |
getTable(java.lang.String name)
Creates a MobileServiceJsonTable
|
<E> MobileServiceTable<E> |
getTable(java.lang.String name,
java.lang.Class<E> clazz)
Creates a MobileServiceTable
|
boolean |
isLoginInProgress()
Indicates if a login operation is in progress
|
void |
login(MobileServiceAuthenticationProvider provider,
com.google.gson.JsonObject oAuthToken,
UserAuthenticationCallback callback)
Invokes Windows Azure Mobile Service authentication using a
provider-specific oAuth token
|
void |
login(MobileServiceAuthenticationProvider provider,
java.lang.String oAuthToken,
UserAuthenticationCallback callback)
Invokes Windows Azure Mobile Service authentication using a
provider-specific oAuth token
|
void |
login(MobileServiceAuthenticationProvider provider,
UserAuthenticationCallback callback)
Invokes an interactive authentication process using the specified
Authentication Provider
|
void |
logout()
Log the user out of the Mobile Service
|
<T> void |
registerDeserializer(java.lang.reflect.Type type,
com.google.gson.JsonDeserializer<T> deserializer)
Registers a JsonDeserializer for the specified type
|
<T> void |
registerSerializer(java.lang.reflect.Type type,
com.google.gson.JsonSerializer<T> serializer)
Registers a JsonSerializer for the specified type
|
void |
setContext(Context mContext)
Sets the Context object for the MobileServiceClient
|
void |
setCurrentUser(MobileServiceUser user)
Sets a user to authenticate the Mobile Service operations
|
void |
setGsonBuilder(com.google.gson.GsonBuilder gsonBuilder)
Sets the GsonBuilder used to in JSON Serialization/Deserialization
|
MobileServiceClient |
withFilter(ServiceFilter serviceFilter)
Adds a new filter to the MobileServiceClient
|
public static final java.lang.String UTF8_ENCODING
public MobileServiceClient(MobileServiceClient client)
client
- An existing MobileServiceClientpublic MobileServiceClient(java.lang.String appUrl, java.lang.String appKey, Context context) throws java.net.MalformedURLException
appUrl
- Mobile Service URLappKey
- Mobile Service application keycontext
- The Context where the MobileServiceClient is createdjava.net.MalformedURLException
public MobileServiceClient(java.net.URL appUrl, java.lang.String appKey, Context context)
appUrl
- Mobile Service URLappKey
- Mobile Service application keycontext
- The Context where the MobileServiceClient is createdpublic static com.google.gson.GsonBuilder createMobileServiceGsonBuilder()
public java.lang.String getAppKey()
public java.net.URL getAppUrl()
public Context getContext()
public MobileServiceUser getCurrentUser()
public com.google.gson.GsonBuilder getGsonBuilder()
public ServiceFilter getServiceFilter()
public <E> MobileServiceTable<E> getTable(java.lang.Class<E> clazz)
clazz
- The class used for table name and data serializationpublic MobileServiceJsonTable getTable(java.lang.String name)
name
- Table namepublic <E> MobileServiceTable<E> getTable(java.lang.String name, java.lang.Class<E> clazz)
name
- Table nameclazz
- The class used for data serializationpublic boolean isLoginInProgress()
public void login(MobileServiceAuthenticationProvider provider, com.google.gson.JsonObject oAuthToken, UserAuthenticationCallback callback)
provider
- The provider used for the authentication processoAuthToken
- A Json object representing the oAuth token used for
authenticationcallback
- Callback to invoke when the authentication process finishespublic void login(MobileServiceAuthenticationProvider provider, java.lang.String oAuthToken, UserAuthenticationCallback callback)
provider
- The provider used for the authentication processoAuthToken
- The oAuth token used for authenticationcallback
- Callback to invoke when the authentication process finishespublic void login(MobileServiceAuthenticationProvider provider, UserAuthenticationCallback callback)
provider
- The provider used for the authentication processcallback
- Callback to invoke when the authentication process finishespublic void logout()
public <T> void registerDeserializer(java.lang.reflect.Type type, com.google.gson.JsonDeserializer<T> deserializer)
type
- The type to use in the registrationdeserializer
- The deserializer to use in the registrationpublic <T> void registerSerializer(java.lang.reflect.Type type, com.google.gson.JsonSerializer<T> serializer)
type
- The type to use in the registrationserializer
- The serializer to use in the registrationpublic void setContext(Context mContext)
public void setCurrentUser(MobileServiceUser user)
user
- The user used to authenticate requestspublic void setGsonBuilder(com.google.gson.GsonBuilder gsonBuilder)
mGsonBuilder
- The GsonBuilder to setpublic MobileServiceClient withFilter(ServiceFilter serviceFilter)
serviceFilter
-