SalesforceSDKManager
This class serves as an interface to the various functions of the Salesforce SDK. In order to use the SDK, your app must first instantiate the singleton SalesforceSDKManager object by calling the static init() method. After calling init(), use the static getInstance() method to access the singleton SalesforceSDKManager object.
TODO: Remove the Android Context property of this object, as it is a memory leak.
Parameters
The Android context
Activity that should be launched after the login flow
Login activity
The Google Cloud Project ID to use with Google Play Integrity API and Salesforce App Attestation or null to disable both features
Types
An action handler in the developer support dialog.
Callback used by getRestClient.
The available Mobile SDK style themes.
Properties
The class for the account switcher activity
The authentication account type, which should match authenticator.xml
An additional list of OAuth keys to fetch and store from the token endpoint
The Salesforce SDK manager's admin permissions manager
The Salesforce SDK manager's admin settings manager
The client side implementation of the Salesforce App Attestation External Client App (ECA) Plugin or null when Salesforce App Attestation is disabled.
Asynchronously retrieves the app config for the specified login host. If not set or null is returned the values found in the BootConfig file will be used for all servers.
The Android context
Returns the app display name used by the passcode dialog
Returns the name of the app as defined in AndroidManifest.xml
The app version
The Salesforce SDK manager's biometric authentication manager
Determines if the authentication web view's cookies will be cleared after authentication. The default behavior is true to protect against re-use of authentication related cookies and duplication authentication action. Only apps the specifically require persistent cookies should set this to false.
Returns a manager bound to the user who is current at the time of access, or null when there is no current user. Retaining the returned manager retains that user's identity even if the application later switches users.
The regular expression pattern used to detect "Use Custom Domain" input from login web view.
The custom tab browser to use during advanced authentication. NB: The default browser on the device is used:
Information to display in the developer support dialog
Forces advanced (browser based) authentication to always be used for login, regardless of the target server's auth configuration, including standard login servers with no My Domain. Defaults to true.
The Salesforce SDK manager's admin settings manager. Only defined if setAllowedSPApps() was called first
Optionally enables browser based login instead of web view login. This should NOT be used directly by apps as this is meant for internal use based on the value configured on the server
Indicates if the The Salesforce Mobile SDK user interface dark theme is enabled. It defaults to Android's dark theme enablement if a Salesforce Mobile SDK theme is not set.
Indicates if IDP login flow is enabled
Indicates if any logout is in progress.
Optionally enables browser session sharing
When true (and isDebugBuild is also true), debug-only UI test affordances such as the Welcome Discovery simulation editor in com.salesforce.androidsdk.ui.LoginOptionsActivity are visible. Mirrors iOS' check for the IS_UI_TESTING launch argument in LoginOptionsViewController.swift.
The class of the activity used to perform the login process and create the account.
The login brand. In the following example, "
The Salesforce SDK manager's login server manager
ViewModel Factory the SDK will use in LoginActivity and composable functions. Setting this will allow for visual customization without overriding LoginActivity.
Returns the class for the main activity.
The Salesforce SDK manager's native login manager
An implementation of PushNotificationInterface that handles received push notifications.
The class fulfilling push notification registration features. A default implementation is provided in PushService. Setting this property to a subclass will inject the specified class instead.
The Salesforce SDK manager's screen lock manager
Sets authentication ability for Salesforce integration users. When true, Salesforce integration users will be prohibited from initial authentication and receive an error message.
The Salesforce Mobile SDK user interface theme. The value is not persistent across instances of Salesforce SDK Manager
Flag for DPoP (Demonstration of Proof-of-Possession, RFC 9449). Defaults to true as of Mobile SDK 14. Controls whether new logins initiate DPoP key generation and DPoP-bound token requests: when true, the SDK attaches a DPoP proof JWT to token endpoint requests and uses the DPoP Authorization scheme for resource requests when the token endpoint advertises token_type: DPoP. Changing this flag only affects logins that happen after the change; it does not retroactively affect existing credentials.
Optionally, enables the hybrid authentication flow. Defaults to true
The Salesforce SDK manager's user account manager
Optionally enables the web server flow for web view log on. Defaults to true
Functions
Determines whether the device has a compact screen. Taken directly from https://developer.android.com/guide/topics/large-screens/large-screen-cookbook#kotlin
Creates the Salesforce App Attestation ECA Plugin Client for the selected Google Cloud Project ID. When using Salesforce App Attestation, this value must match the linked Google Cloud Project ID for the app in Google Play Console's Play Integrity API and provided to the Salesforce App Attestation External Client App Plugin.
Builds developer support actions for the developer support dialog.
Returns the Salesforce Notifications API types endpoint notification type with the provided type.
Returns an authenticated client for the current user or starts login when no persisted account is current. If the current account cannot produce a valid user and client, removes that exact corrupt account and completes the normal logout, account-switching, or login flow without invoking restClientCallback.
Returns a client that carries no persisted user credentials.
Returns a user agent string based on the Salesforce Mobile SDK version. The user agent takes the following form: SalesforceMobileSDK/{salesforceSDK version} android/{android OS version} {provideAppName()}/appVersion {Native|Hybrid} uid_{device id}
Returns a per-user agent string. Feature flags include both global and user-specific codes.
Indicates if a network connection is available.
Invokes a Salesforce Notifications API notification action.
Indicates if developer support features are enabled. Defaults to BuildConfig.DEBUG unless another value is specified.
Returns true if the feature code is in the global (non-user-specific) set.
Returns whether this exact Android account is currently being logged out.
Destroys the stored authentication credentials (removes the account) and, if requested, restarts the app.
Adds an app feature code for reporting in the user agent header
Adds a per-user app feature code for reporting in the user agent header. Falls back to the global set when user is null.
Sets the allowed SP apps for this app. As a result this app gets an IDP manager and can be used as an IDP
Sets the IDP package name for this app. As a result, this app gets an SP Manager and can be used as an SP
Sets if developer support features are enabled.
Sets the system status and navigation bars to the light theme without regard to the system theme. This is useful when the background is light even when dark theme is enabled.
Displays developer support for a specified Android activity.
Removes an app feature code from reporting in the user agent header
Removes a per-user app feature code from reporting in the user agent header. Falls back to the global set when user is null.
Creates a NativeLoginManager instance that allows the app to use its own native UI for authentication.