public static final class

AirshipConfigOptions.Builder

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

Class Overview

Airship config builder.

Summary

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 setAnalyticsServer(String analyticsServer)
Set the analytics server URL.
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 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 setClearNamedUser(boolean clearNamedUser)
Set the flag whether to clear an existing named user during a re-install.
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 setDevelopmentFcmSenderId(String senderId)
Sets the development FCM sender ID.
AirshipConfigOptions.Builder setDevelopmentLogLevel(int developmentLogLevel)
Set the logger level when the application is in debug mode.
AirshipConfigOptions.Builder setEnableUrlWhitelisting(boolean enableUrlWhitelisting)
Enables/disables whitelist checks for SCOPE_OPEN_URL.
AirshipConfigOptions.Builder setFcmSenderId(String senderId)
Sets the default FCM sender ID.
AirshipConfigOptions.Builder setGcmSender(String gcmSender)
This method is deprecated. Set the FCM sender ID instead.
AirshipConfigOptions.Builder setHostURL(String hostURL)
Set the Urban Airship URL.
AirshipConfigOptions.Builder setInProduction(boolean inProduction)
Set the flag indicating whether the application is in production or development.
AirshipConfigOptions.Builder setLandingPageContentURL(String landingPageContentURL)
Set the landing page content URL.
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 setProductionAppKey(String productionAppKey)
Set the application's production app key.
AirshipConfigOptions.Builder setProductionAppSecret(String productionAppSecret)
Set the application's production app secret.
AirshipConfigOptions.Builder setProductionFcmSenderId(String senderId)
Sets the production FCM sender ID.
AirshipConfigOptions.Builder setProductionLogLevel(int productionLogLevel)
Set the logger level when the application is in production mode.
AirshipConfigOptions.Builder setRemoteDataURL(String remoteDataURL)
Set the remote data URL.
AirshipConfigOptions.Builder setWalletUrl(String walletUrl)
Set the Wallet URL.
AirshipConfigOptions.Builder setWhitelist(String[] whitelist)
Set the list of additional URLs that are allowed to be used for various features, including: Urban Airship JS interface, open external URL action, wallet action, HTML in-app messages, and landing pages.
[Expand]
Inherited Methods
From class java.lang.Object

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"
    fcmSenderId = "Your FCM sender ID is your Google API project number (required for GCM)" />
 
 

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

 # Required for FCM
 fcmSenderId = Your FCM sender ID is your Google API project number (required for GCM)

 # 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. Will fail if any of the following preconditions are not met.

 1. If inProduction is false, development app key and secret must be set.
 2. If inProduction is true, production app key and secret must be set.
 3. The analytics URI must not be empty if analytics are enabled.
 4. The host URL must not be empty.
 

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 setAnalyticsServer (String analyticsServer)

Set the analytics server URL.

Parameters
analyticsServer The analytics server URL.
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 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 setClearNamedUser (boolean clearNamedUser)

Set the flag whether to clear an existing named user during a re-install.

Parameters
clearNamedUser The flag whether to clear an existing named user during a re-install.
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 setDevelopmentFcmSenderId (String senderId)

Sets the development FCM sender ID.

Optional if you are using `urbanairship-fcm` package and want Urban Airship to use the main Firebase application's sender ID.

Parameters
senderId The development FCM sender ID.
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 setEnableUrlWhitelisting (boolean enableUrlWhitelisting)

Enables/disables whitelist checks for SCOPE_OPEN_URL. If disabled, any URL checks with scope SCOPE_OPEN_URL will be allowed even if the URL is not in the whitelist.

Returns
  • The config options builder.

public AirshipConfigOptions.Builder setFcmSenderId (String senderId)

Sets the default FCM sender ID.

Optional if you are using `urbanairship-fcm` package and want Urban Airship to use the main Firebase application's sender ID.

Parameters
senderId The FCM sender ID.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setGcmSender (String gcmSender)

This method is deprecated.
Set the FCM sender ID instead.

Set the sender ID used to send GCM pushes.

Parameters
gcmSender The sender ID used to send GCM pushes.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setHostURL (String hostURL)

Set the Urban Airship URL.

Parameters
hostURL The Urban Airship URL.
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 setLandingPageContentURL (String landingPageContentURL)

Set the landing page content URL.

Parameters
landingPageContentURL The landing page content URL.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setNotificationAccentColor (int notificationAccentColor)

Sets the default notification accent color.

See setColor(int).

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

public AirshipConfigOptions.Builder setNotificationChannel (String channel)

Sets the default notification channel.

See setNotificationChannel(String).

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

public AirshipConfigOptions.Builder setNotificationIcon (int notificationIcon)

Sets the default notification Icon.

See setSmallIconId(int).

Parameters
notificationIcon The 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 setProductionFcmSenderId (String senderId)

Sets the production FCM sender ID.

Optional if you are using `urbanairship-fcm` package and want Urban Airship to use the main Firebase application's sender ID.

Parameters
senderId The production FCM sender ID.
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 setRemoteDataURL (String remoteDataURL)

Set the remote data URL.

Parameters
remoteDataURL The remote data URL.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setWalletUrl (String walletUrl)

Set the Wallet URL.

Parameters
walletUrl The Wallet URL.
Returns
  • The config options builder.

public AirshipConfigOptions.Builder setWhitelist (String[] whitelist)

Set the list of additional URLs that are allowed to be used for various features, including: Urban Airship JS interface, open external URL action, wallet action, HTML in-app messages, and landing pages. Urban Airship https URLs are included by default.

Parameters
whitelist The whitelist.
Returns
  • The config options builder.