FirebaseOptions.Builder

public static final class FirebaseOptions.Builder extends Object

Builder for constructing FirebaseOptions.

Public Constructor Summary

FirebaseOptions.Builder()
Constructs an empty builder.
FirebaseOptions.Builder(FirebaseOptions options)
Initializes the builder's values from the options object.

Public Method Summary

FirebaseOptions
build()
Builds the FirebaseOptions instance from the previously set options.
FirebaseOptions.Builder
setCredential(FirebaseCredential credential)
Sets the FirebaseCredential to use to authenticate the SDK.
FirebaseOptions.Builder
setDatabaseAuthVariableOverride(Map<String, Object> databaseAuthVariableOverride)
Sets the auth variable to be used by the Realtime Database rules.
FirebaseOptions.Builder
setDatabaseUrl(String databaseUrl)
Sets the Realtime Database URL to use for data storage.
FirebaseOptions.Builder
setServiceAccount(InputStream stream)
This method was deprecated. Use setCredential(FirebaseCredential) instead and obtain credentials via FirebaseCredentials.

Inherited Method Summary

Public Constructors

public FirebaseOptions.Builder ()

Constructs an empty builder.

public FirebaseOptions.Builder (FirebaseOptions options)

Initializes the builder's values from the options object.

The new builder is not backed by this objects values, that is changes made to the new builder don't change the values of the origin object.

Public Methods

public FirebaseOptions build ()

Builds the FirebaseOptions instance from the previously set options.

Returns

public FirebaseOptions.Builder setCredential (FirebaseCredential credential)

Sets the FirebaseCredential to use to authenticate the SDK.

This method replaces the deprecated setServiceAccount(InputStream) method.

See Initialize the SDK for code samples and detailed documentation.

Parameters
credential A FirebaseCredential used to authenticate the SDK. See FirebaseCredentials for default implementations.
Returns
  • This Builder instance is returned so subsequent calls can be chained.

public FirebaseOptions.Builder setDatabaseAuthVariableOverride (Map<String, Object> databaseAuthVariableOverride)

Sets the auth variable to be used by the Realtime Database rules.

When set, security rules for Realtime Database actions are evaluated using the provided auth object. During evaluation the object is available on the auth variable. Use this option to enforce schema validation and additional security for this app instance.

If this option is not provided, security rules are bypassed entirely for this app instance. If this option is set to null, security rules are evaluated against an unauthenticated user. That is, the auth variable is null.

See Authenticate with limited privileges for code samples and detailed documentation.

Parameters
databaseAuthVariableOverride The value to use for the auth variable in the security rules for Realtime Database actions.
Returns
  • This Builder instance is returned so subsequent calls can be chained.

public FirebaseOptions.Builder setDatabaseUrl (String databaseUrl)

Sets the Realtime Database URL to use for data storage.

See Initialize the SDK for code samples and detailed documentation.

Parameters
databaseUrl The Realtime Database URL to use for data storage.
Returns
  • This Builder instance is returned so subsequent calls can be chained.

public FirebaseOptions.Builder setServiceAccount (InputStream stream)

This method was deprecated.
Use setCredential(FirebaseCredential) instead and obtain credentials via FirebaseCredentials.

Sets the service account to use to authenticate the SDK.

This method is deprecated in favor of the setCredential(FirebaseCredential) method. Only one of the setCredential() and setServiceAccount() methods can be used.

Parameters
stream A stream containing the service account contents as JSON.
Returns
  • This Builder instance is returned so subsequent calls can be chained.

Send feedback about...

Need help? Visit our support page.