Package com.parse
Class Parse
- java.lang.Object
-
- com.parse.Parse
-
public class Parse extends java.lang.Object
TheParse
class contains static functions that handle global configuration for the Parse library.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Parse.Configuration
Represents an opaque configuration for theParse
SDK configuration.
-
Field Summary
Fields Modifier and Type Field Description static int
LOG_LEVEL_DEBUG
static int
LOG_LEVEL_ERROR
static int
LOG_LEVEL_INFO
static int
LOG_LEVEL_NONE
static int
LOG_LEVEL_VERBOSE
static int
LOG_LEVEL_WARNING
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkInit()
Used by Parse LiveQuerystatic void
destroy()
Destroys this client and erases its local data store.static void
enableLocalDatastore(Context context)
Enable pinning in your application.static Context
getApplicationContext()
static int
getLogLevel()
Returns the level of logging that will be displayed.static java.io.File
getParseCacheDir(java.lang.String subDir)
static java.lang.String
getServer()
Returns the current server URL.static void
initialize(Parse.Configuration configuration)
Authenticates this client as belonging to your application.static boolean
isAllowCustomObjectId()
static boolean
isLocalDatastoreEnabled()
static void
setLogLevel(int logLevel)
Sets the level of logging to display, where each level includes all those below it.static void
setServer(java.lang.String server)
Sets the server URL.
-
-
-
Field Detail
-
LOG_LEVEL_VERBOSE
public static final int LOG_LEVEL_VERBOSE
-
LOG_LEVEL_DEBUG
public static final int LOG_LEVEL_DEBUG
-
LOG_LEVEL_INFO
public static final int LOG_LEVEL_INFO
-
LOG_LEVEL_WARNING
public static final int LOG_LEVEL_WARNING
-
LOG_LEVEL_ERROR
public static final int LOG_LEVEL_ERROR
-
LOG_LEVEL_NONE
public static final int LOG_LEVEL_NONE
- See Also:
- Constant Field Values
-
-
Method Detail
-
enableLocalDatastore
public static void enableLocalDatastore(Context context)
Enable pinning in your application. This must be called before your application can use pinning. You must invokeenableLocalDatastore(Context)
beforeinitialize(Configuration)
:public class MyApplication extends Application { public void onCreate() { Parse.enableLocalDatastore(this); Parse.initialize(this); } }
See https://github.com/parse-community/Parse-SDK-Android/issues/279 for a discussion on performance of local datastore, and if it is right for your project.
- Parameters:
context
- The activeContext
for your application.
-
isLocalDatastoreEnabled
public static boolean isLocalDatastoreEnabled()
-
isAllowCustomObjectId
public static boolean isAllowCustomObjectId()
- Returns:
True
ifParse.Configuration.Builder.allowCustomObjectId()
has been called, otherwisefalse
.
-
initialize
public static void initialize(Parse.Configuration configuration)
Authenticates this client as belonging to your application. This must be called before your application can use the Parse library. The recommended way is to put a call toParse.initialize
in yourApplication
'sonCreate
method:public class MyApplication extends Application { public void onCreate() { Parse.initialize(configuration); } }
- Parameters:
configuration
- The configuration for your application.
-
getServer
public static java.lang.String getServer()
Returns the current server URL.
-
setServer
public static void setServer(java.lang.String server)
Sets the server URL. The local client cache is not cleared.This can be used to update the server URL after this client has been initialized, without having to
destroy()
this client. An example use case is server connection failover, where the clients connects to another URL if the server becomes unreachable at the current URL.Warning:
The new server URL must point to a Parse Server that connects to the same database. Otherwise, issues may arise related to locally cached data or delayed methods such asParseObject.saveEventually()
.- Parameters:
server
- The server URL to set.
-
destroy
public static void destroy()
Destroys this client and erases its local data store. Calling this afterinitialize(com.parse.Parse.Configuration)
allows you to re-initialize this client with a new configuration. Calling this while server requests are in progress can cause undefined behavior.
-
getApplicationContext
public static Context getApplicationContext()
-
getParseCacheDir
public static java.io.File getParseCacheDir(java.lang.String subDir)
-
checkInit
public static void checkInit()
Used by Parse LiveQuery
-
getLogLevel
public static int getLogLevel()
Returns the level of logging that will be displayed.
-
setLogLevel
public static void setLogLevel(int logLevel)
Sets the level of logging to display, where each level includes all those below it. The default level isLOG_LEVEL_NONE
. Please ensure this is set toLOG_LEVEL_ERROR
orLOG_LEVEL_NONE
before deploying your app to ensure no sensitive information is logged. The levels are:- Parameters:
logLevel
- The level of logcat logging that Parse should do.
-
-