Package com.parse

Class Parse


  • public class Parse
    extends java.lang.Object
    The Parse class contains static functions that handle global configuration for the Parse library.
    • 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
    • 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 invoke enableLocalDatastore(Context) before initialize(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 active Context for your application.
      • isLocalDatastoreEnabled

        public static boolean isLocalDatastoreEnabled()
      • 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 to Parse.initialize in your Application's onCreate 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 as ParseObject.saveEventually().

        Parameters:
        server - The server URL to set.
      • destroy

        public static void destroy()
        Destroys this client and erases its local data store. Calling this after initialize(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.