Package com.mongodb.stitch.android.core
Class Stitch
- java.lang.Object
-
- com.mongodb.stitch.android.core.Stitch
-
public final class Stitch extends Object
The entry point into the Android SDK. This class is responsible for allowing one to initializeStitchAppClient
s and work with Stitch.
-
-
Method Summary
Modifier and Type Method Description static StitchAppClient
getAppClient(String clientAppId)
Gets an app client by its client app id if it has been initialized; throws if none can be found.static StitchAppClient
getDefaultAppClient()
Gets the default initialized app client.static boolean
hasAppClient(String clientAppId)
Checks if an app client has been initialized by its client app id.static void
initialize(Context context)
Initializes the Stitch SDK so that app clients can be created.static StitchAppClient
initializeAppClient(String clientAppId)
Initializes an app client for Stitch to use when usinggetAppClient(String)
}.static StitchAppClient
initializeAppClient(String clientAppId, StitchAppClientConfiguration config)
Initializes an app client for Stitch to use when usinggetAppClient(String)
}.static StitchAppClient
initializeDefaultAppClient(String clientAppId)
Initializes the default app client for Stitch to use when usinggetDefaultAppClient()
.static StitchAppClient
initializeDefaultAppClient(String clientAppId, StitchAppClientConfiguration config)
Initializes the default app client for Stitch to use when usinggetDefaultAppClient()
.
-
-
-
Method Detail
-
initialize
public static void initialize(Context context)
Initializes the Stitch SDK so that app clients can be created.- Parameters:
context
- An Android context value.
-
getDefaultAppClient
public static StitchAppClient getDefaultAppClient()
Gets the default initialized app client. If one has not been set, then an error will be thrown.StitchInitProvider
will normally automatically initialize the default app client using configured resource values butinitializeDefaultAppClient(String)
can also be used to initialize the default app client.- Returns:
- The default initialized app client.
-
getAppClient
public static StitchAppClient getAppClient(@Nonnull String clientAppId)
Gets an app client by its client app id if it has been initialized; throws if none can be found.- Parameters:
clientAppId
- the client app id of the app client to get.- Returns:
- the app client associated with the client app id.
-
hasAppClient
public static boolean hasAppClient(String clientAppId)
Checks if an app client has been initialized by its client app id.- Parameters:
clientAppId
- the client app id to search for.- Returns:
- if an app client has been initialized by its client app id.
-
initializeDefaultAppClient
public static StitchAppClient initializeDefaultAppClient(@Nonnull String clientAppId)
Initializes the default app client for Stitch to use when usinggetDefaultAppClient()
. Can only be called once.- Parameters:
clientAppId
- the client app id to initialize an app client for.- Returns:
- the app client that was just initialized.
-
initializeDefaultAppClient
public static StitchAppClient initializeDefaultAppClient(@Nonnull String clientAppId, @Nonnull StitchAppClientConfiguration config)
Initializes the default app client for Stitch to use when usinggetDefaultAppClient()
. Can only be called once.- Parameters:
clientAppId
- the client app id to initialize an app client for.config
- the configuration to use to build the app client.- Returns:
- the app client that was just initialized.
-
initializeAppClient
public static StitchAppClient initializeAppClient(@Nonnull String clientAppId)
Initializes an app client for Stitch to use when usinggetAppClient(String)
}. Can only be called once per client app id.- Parameters:
clientAppId
- the client app id to initialize an app client for.- Returns:
- the app client that was just initialized.
-
initializeAppClient
public static StitchAppClient initializeAppClient(@Nonnull String clientAppId, @Nonnull StitchAppClientConfiguration config)
Initializes an app client for Stitch to use when usinggetAppClient(String)
}. Can only be called once per client app id.- Parameters:
clientAppId
- the client app id to initialize an app client for.config
- the configuration to use to build the app client.- Returns:
- the app client that was just initialized.
-
-