public static final class

AirshipConfigOptions.Builder

extends Object
java.lang.Object
   ↳ com.urbanairship.AirshipConfigOptions.Builder

Class Overview

Airship config builder.

Summary

Fields
public int enabledFeatures
Public Constructors
Builder()
Public Methods
AirshipConfigOptions.Builder applyConfig(Context context, int xmlResourceId)
Apply options from a xml resource file.
AirshipConfigOptions.Builder applyDefaultProperties(Context context)
Apply the options from the default properties file airshipconfig.properties.
AirshipConfigOptions.Builder applyProperties(Context context, String propertiesFile)
Apply the options from a given properties file.
AirshipConfigOptions.Builder applyProperties(Context context, Properties properties)
Applies properties from a given Properties object.
AirshipConfigOptions build()
Builds the config options.
AirshipConfigOptions.Builder detectProvisioningMode(Context context)
Automatically determine the provisioning mode of the application.
AirshipConfigOptions.Builder setAllowedTransports(String[] allowedTransports)
Set the transport types allowed for Push.
AirshipConfigOptions.Builder setAnalyticsEnabled(boolean analyticsEnabled)
Set the flag indicating whether the application will use analytics.
AirshipConfigOptions.Builder setAppKey(String appKey)
Set the default app key.
AirshipConfigOptions.Builder setAppSecret(String appSecret)
Set the default app secret.
AirshipConfigOptions.Builder setAppStoreUri(Uri appStoreUri)
Sets the app store URI for the rate-app action.
AirshipConfigOptions.Builder setAutoLaunchApplication(boolean autoLaunchApplication)
Set the flag indicating whether or not to launch the launcher activity when a push notification or push notification button is opened and the application intent receiver did not launch an activity.
AirshipConfigOptions.Builder setAutoPauseInAppAutomationOnLaunch(boolean autoPauseInAppAutomationOnLaunch)
Set the auto pause In-App Automation on launch.
AirshipConfigOptions.Builder setBackgroundReportingIntervalMS(long backgroundReportingIntervalMS)
Set the background reporting interval.
AirshipConfigOptions.Builder setChannelCaptureEnabled(boolean channelCaptureEnabled)
Set the flag indicating whether channel capture feature is enabled or not.
AirshipConfigOptions.Builder setChannelCreationDelayEnabled(boolean channelCreationDelayEnabled)
Set the flag indicating whether channel creation delay is enabled or not.
AirshipConfigOptions.Builder setDataCollectionOptInEnabled(boolean dataCollectionOptInEnabled)
This method is deprecated. Use enabledFeatures instead.
AirshipConfigOptions.Builder setDevelopmentAppKey(String developmentAppKey)
Set the application's development app key.
AirshipConfigOptions.Builder setDevelopmentAppSecret(String developmentAppSecret)
Set the application's development app secret.
AirshipConfigOptions.Builder setDevelopmentLogLevel(int developmentLogLevel)
Set the logger level when the application is in debug mode.
AirshipConfigOptions.Builder setEnabledFeatures(int... enabledFeatures)
Sets the default enabled SDK features.
AirshipConfigOptions.Builder setExtendedBroadcastsEnabled(boolean extendedBroadcastsEnabled)
Set the flag indicating whether extended broadcasts are enabled or disabled.
AirshipConfigOptions.Builder setFcmFirebaseAppName(String fcmFirebaseAppName)
Sets the Firebase app name that is used for FCM.
AirshipConfigOptions.Builder setInProduction(boolean inProduction)
Set the flag indicating whether the application is in production or development.
AirshipConfigOptions.Builder setInitialConfigUrl(String initialConfigUrl)
The Airship URL used to pull the initial config.
AirshipConfigOptions.Builder setIsPromptForPermissionOnUserNotificationsEnabled(boolean enabled)
Sets if when enabling setUserNotificationsEnabled(boolean) if the SDK should prompt for permission on Android 13+ devices.
AirshipConfigOptions.Builder setLogLevel(int logLevel)
Set the default logger level.
AirshipConfigOptions.Builder setNotificationAccentColor(int notificationAccentColor)
Sets the default notification accent color.
AirshipConfigOptions.Builder setNotificationChannel(String channel)
Sets the default notification channel.
AirshipConfigOptions.Builder setNotificationIcon(int notificationIcon)
Sets the default notification Icon.
AirshipConfigOptions.Builder setNotificationLargeIcon(int notificationLargeIcon)
Sets the large notification Icon.
AirshipConfigOptions.Builder setProductionAppKey(String productionAppKey)
Set the application's production app key.
AirshipConfigOptions.Builder setProductionAppSecret(String productionAppSecret)
Set the application's production app secret.
AirshipConfigOptions.Builder setProductionLogLevel(int productionLogLevel)
Set the logger level when the application is in production mode.
AirshipConfigOptions.Builder setRequireInitialRemoteConfigEnabled(boolean requireInitialRemoteConfigEnabled)
Sets the flag to require initial remote-config for device URLs.
AirshipConfigOptions.Builder setSite(String site)
Sets the Airship cloud site for data locality.
AirshipConfigOptions.Builder setUrlAllowList(String[] urlAllowList)
Sets the additional URLs that will be added to the allow list for both SCOPE_OPEN_URL and SCOPE_JAVASCRIPT_INTERFACE scopes.
AirshipConfigOptions.Builder setUrlAllowListScopeJavaScriptInterface(String[] urlAllowListScopeJavaScriptInterface)
Sets the additional URLs that will be added to the allow list for scope SCOPE_JAVASCRIPT_INTERFACE.
AirshipConfigOptions.Builder setUrlAllowListScopeOpenUrl(String[] urlAllowListScopeOpenUrl)
Sets the additional URLs that will be added to the allow list for scope SCOPE_OPEN_URL.
AirshipConfigOptions.Builder tryApplyConfig(Context context, int xmlResourceId)
The same as applyConfig(Context, int), but throws an exception instead of logging an error.
AirshipConfigOptions.Builder tryApplyDefaultProperties(Context context)
Same as applyDefaultProperties(Context), but throws an exception instead of logging an error.
AirshipConfigOptions.Builder tryApplyProperties(Context context, Properties properties)
The same as applyProperties(Context, Properties), but throws an exception instead of logging an error.
AirshipConfigOptions.Builder tryApplyProperties(Context context, String propertiesFile)
Same as applyProperties(Context, String), but throws an exception instead of logging an error.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public int enabledFeatures

Public Constructors

public Builder ()

Public Methods

public AirshipConfigOptions.Builder applyConfig (Context context, int xmlResourceId)

Apply options from a xml resource file. The XML file must contain the element AirshipConfigOptions and any public AirshipConfigOptions fields should be set as attributes on the element. Example:

 <AirshipConfigOptions
    notificationIcon = "@drawable/ic_notification"
    notificationAccentColor = "@color/color_accent"
    inProduction = "false"
    productionAppKey = "Your Production App Key"
    productionAppSecret = "Your Production App Secret"
    productionLogLevel = "NONE"
    developmentAppKey = "Your Development App Key"
    developmentAppSecret = "Your Development App Secret"
    developmentLogLevel = "VERBOSE"
 
 

Parameters
context The application context.
xmlResourceId The xml resource ID.
Returns
  • The config option builder.

public AirshipConfigOptions.Builder applyDefaultProperties (Context context)

Apply the options from the default properties file airshipconfig.properties.

See applyProperties(Context, String).

Parameters
context The application context
Returns
  • The config option builder.

public AirshipConfigOptions.Builder applyProperties (Context context, String propertiesFile)

Apply the options from a given properties file. The properties file should be available in the assets directory. The properties file can define any of the public AirshipConfigOptions fields. Example:

 # App Credentials
 developmentAppKey = Your Development App Key
 developmentAppSecret = Your Development App Secret
 productionAppKey = Your Production App Key
 productionAppSecret = Your Production Secret

 # Flag to indicate what credentials to use
 inProduction = false

 # Log levels
 developmentLogLevel = DEBUG
 productionLogLevel = ERROR

 # Notification settings
 notificationIcon = ic_notification
 notificationAccentColor = #ff0000

 
 

Parameters
context The application context.
propertiesFile The name of the properties file in the assets directory.
Returns
  • The config option builder.

public AirshipConfigOptions.Builder applyProperties (Context context, Properties properties)

Applies properties from a given Properties object.

Parameters
context The application context.
properties The properties
Returns
  • The config option builder.

public AirshipConfigOptions build ()

Builds the config options.

Returns
  • The built config options.

public AirshipConfigOptions.Builder detectProvisioningMode (Context context)

Automatically determine the provisioning mode of the application.

Parameters
context The application context.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setAllowedTransports (String[] allowedTransports)

Set the transport types allowed for Push.

Parameters
allowedTransports The transport types allowed for Push.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setAnalyticsEnabled (boolean analyticsEnabled)

Set the flag indicating whether the application will use analytics.

Parameters
analyticsEnabled The flag indicating whether the application will use analytics.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setAppKey (String appKey)

Set the default app key. The development and production app keys will take precedence if defined depending on how the inProduction flag is set.

Parameters
appKey The application's app key.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setAppSecret (String appSecret)

Set the default app secret. The development and production app secret will take precedence if defined depending on how the inProduction flag is set.

Parameters
appSecret The application's production app secret.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setAppStoreUri (Uri appStoreUri)

Sets the app store URI for the rate-app action. If not set, the action will generate it using the app's current package name.

Example: "market://details?id=com.example.android"

Parameters
appStoreUri The app store URI.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setAutoLaunchApplication (boolean autoLaunchApplication)

Set the flag indicating whether or not to launch the launcher activity when a push notification or push notification button is opened and the application intent receiver did not launch an activity.

Parameters
autoLaunchApplication The auto launch flag.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setAutoPauseInAppAutomationOnLaunch (boolean autoPauseInAppAutomationOnLaunch)

Set the auto pause In-App Automation on launch.

Parameters
autoPauseInAppAutomationOnLaunch true to auto pause In-App Automation, otherwise false.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setBackgroundReportingIntervalMS (long backgroundReportingIntervalMS)

Set the background reporting interval.

Parameters
backgroundReportingIntervalMS The background reporting interval.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setChannelCaptureEnabled (boolean channelCaptureEnabled)

Set the flag indicating whether channel capture feature is enabled or not.

Parameters
channelCaptureEnabled The flag indicating whether channel capture feature is enabled or not.
Returns
  • The config option builder.

public AirshipConfigOptions.Builder setChannelCreationDelayEnabled (boolean channelCreationDelayEnabled)

Set the flag indicating whether channel creation delay is enabled or not.

Parameters
channelCreationDelayEnabled The flag indicating whether channel creation delay is enabled or not.
Returns
  • The config option builder.

public AirshipConfigOptions.Builder setDataCollectionOptInEnabled (boolean dataCollectionOptInEnabled)

This method is deprecated.
Use enabledFeatures instead.

Set the flag indicating whether data collection needs to be opted in with setDataCollectionEnabled(boolean). This flag will only take affect on first run. If previously not enabled, the device will still have data collection enabled until disabled with setDataCollectionEnabled(boolean).

Parameters
dataCollectionOptInEnabled The flag indicating whether data collection needs to be opted in.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setDevelopmentAppKey (String developmentAppKey)

Set the application's development app key.

Parameters
developmentAppKey The application's development app key.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setDevelopmentAppSecret (String developmentAppSecret)

Set the application's development app secret.

Parameters
developmentAppSecret The application's development app secret.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setDevelopmentLogLevel (int developmentLogLevel)

Set the logger level when the application is in debug mode.

Parameters
developmentLogLevel The logger level.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setEnabledFeatures (int... enabledFeatures)

Sets the default enabled SDK features. See PrivacyManager for more info.

Parameters
enabledFeatures The enabled features.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setExtendedBroadcastsEnabled (boolean extendedBroadcastsEnabled)

Set the flag indicating whether extended broadcasts are enabled or disabled. When extended broadcasts are enabled, the channel identifier and app key are added to the AIRSHIP_READY broadcast and the channel identifier is included in a new CHANNEL_CREATED broadcast.

Parameters
extendedBroadcastsEnabled The flag indicating whether extended broadcasts are enabled or disabled.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setFcmFirebaseAppName (String fcmFirebaseAppName)

Sets the Firebase app name that is used for FCM. If set, the app name must exist in order for Airship to get registration token. The app should be initialized with Firebase before takeOff, or during onAirshipReady callback.

Parameters
fcmFirebaseAppName The firebase app name.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setInProduction (boolean inProduction)

Set the flag indicating whether the application is in production or development.

Parameters
inProduction The flag indicating whether the application is in production or development.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setInitialConfigUrl (String initialConfigUrl)

The Airship URL used to pull the initial config. This should only be set if you are using custom domains that forward to Airship.

Parameters
initialConfigUrl The initial config URL.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setIsPromptForPermissionOnUserNotificationsEnabled (boolean enabled)

Sets if when enabling setUserNotificationsEnabled(boolean) if the SDK should prompt for permission on Android 13+ devices. Enabled by default.

Parameters
enabled true to prompt for notifications when user notifications are enabled, otherwise false.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setLogLevel (int logLevel)

Set the default logger level. The development and production log level will take precedence if defined depending on how the inProduction flag is set.

Parameters
logLevel The logger level.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setNotificationAccentColor (int notificationAccentColor)

Sets the default notification accent color.

See setDefaultAccentColor(int).

Parameters
notificationAccentColor The notification accent color.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setNotificationChannel (String channel)

Sets the default notification channel.

See onCreateNotificationArguments(Context, PushMessage)

Parameters
channel The notification channel.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setNotificationIcon (int notificationIcon)

Sets the default notification Icon.

See setSmallIcon(int).

Parameters
notificationIcon The notification icon.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setNotificationLargeIcon (int notificationLargeIcon)

Sets the large notification Icon.

See setLargeIcon(int).

Parameters
notificationLargeIcon The large notification icon.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setProductionAppKey (String productionAppKey)

Set the application's production app key.

Parameters
productionAppKey The application's production app key.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setProductionAppSecret (String productionAppSecret)

Set the application's production app secret.

Parameters
productionAppSecret The application's production app secret.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setProductionLogLevel (int productionLogLevel)

Set the logger level when the application is in production mode.

Parameters
productionLogLevel The logger level.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setRequireInitialRemoteConfigEnabled (boolean requireInitialRemoteConfigEnabled)

Sets the flag to require initial remote-config for device URLs.

Parameters
requireInitialRemoteConfigEnabled true to require initial remote-config, otherwise false.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setSite (String site)

Sets the Airship cloud site for data locality.

Parameters
site The airship cloud site.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setUrlAllowList (String[] urlAllowList)

Sets the additional URLs that will be added to the allow list for both SCOPE_OPEN_URL and SCOPE_JAVASCRIPT_INTERFACE scopes. See addEntry(String) for valid URL patterns.

Parameters
urlAllowList An array of URL patterns.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setUrlAllowListScopeJavaScriptInterface (String[] urlAllowListScopeJavaScriptInterface)

Sets the additional URLs that will be added to the allow list for scope SCOPE_JAVASCRIPT_INTERFACE. See addEntry(String) for valid URL patterns.

Parameters
urlAllowListScopeJavaScriptInterface An array of URL patterns.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setUrlAllowListScopeOpenUrl (String[] urlAllowListScopeOpenUrl)

Sets the additional URLs that will be added to the allow list for scope SCOPE_OPEN_URL. See addEntry(String) for valid URL patterns.

Parameters
urlAllowListScopeOpenUrl An array of URL patterns.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder tryApplyConfig (Context context, int xmlResourceId)

The same as applyConfig(Context, int), but throws an exception instead of logging an error.

Parameters
context The application context.
xmlResourceId The xml resource ID.
Returns
  • The config option builder.
Throws
Exception

public AirshipConfigOptions.Builder tryApplyDefaultProperties (Context context)

Same as applyDefaultProperties(Context), but throws an exception instead of logging an error.

Parameters
context The application context
Returns
  • The config option builder.

public AirshipConfigOptions.Builder tryApplyProperties (Context context, Properties properties)

The same as applyProperties(Context, Properties), but throws an exception instead of logging an error.

Parameters
context The application context.
properties The properties
Returns
  • The config option builder.

public AirshipConfigOptions.Builder tryApplyProperties (Context context, String propertiesFile)

Same as applyProperties(Context, String), but throws an exception instead of logging an error.

Parameters
context The application context.
propertiesFile The name of the properties file in the assets directory.
Returns
  • The config option builder.