Autopilot

Autopilot allows UAirship.takeOff to be called without overriding the Application class. Typically, UAirship.takeOff must be called in Application.onCreate() so that the Airship library is ready to handle incoming events before intents are delivered to any application components. Calling takeOff directly is the simplest integration, however some application frameworks do not provide a way to extend the Application class. Autopilot allows you to provide your bootstrapping code in a way that allows the library to lazily execute it.

Autopilot will be called before onCreate on the main process. If this is too early for the application to handle takeOff, it can be delayed by overriding allowEarlyTakeOff. If delayed or if the application uses multiple processes, automaticTakeOff must be called at all application entry points (i.e., in the onCreate() method of all registered Broadcast Receivers, Activities and Services).

The default com.urbanairship.AirshipConfigOptions will be created from the airshipconfig.properties file from the assets. To provide a different config, override createAirshipConfigOptions.

The default Autopilot behavior will call takeOff and load airship config options from the airshipconfig.properties file in the assets directory. To use autopilot, add the following entry to the application block in the Application AndroidManifest.xml:


 <meta-data android:name="com.urbanairship.autopilot"
          android:value="com.urbanairship.Autopilot" /> 

Autopilot can be customized in order to load config from a different source or to customize the Airship instance when it is ready. To customize Autopilot, extend the class and override either allowEarlyTakeOff, onAirshipReady, or createAirshipConfigOptions methods. The class must be non-abstract, public, and it should only have a single public, no-argument constructor. Register the class by adding an entry to the application block of your manifest containing the fully qualified class name of your Autopilot implementation:


 <meta-data android:name="com.urbanairship.autopilot"
          android:value="com.urbanairship.push.sample.SampleAutopilot" /> 

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
val AUTOPILOT_MANIFEST_KEY: String = "com.urbanairship.autopilot"
The name of the AndroidManifest meta-data element used to hold the fully qualified class name of the application's Autopilot implementation.

Functions

Link copied to clipboard
Checks if Autopilot is able to takeOff before onCreate.
Link copied to clipboard
open fun automaticTakeOff(@NonNull application: Application)
open fun automaticTakeOff(@NonNull context: Context)
Starts the auto pilot takeOff process.
Link copied to clipboard
Implement this method to provide com.urbanairship.AirshipConfigOptions for takeOff.
Link copied to clipboard
open fun isReady(@NonNull context: Context): Boolean
Called before automaticTakeOff to make sure Autopilot is ready to takeOff.
Link copied to clipboard
open fun onAirshipReady(@NonNull airship: UAirship)
Called before the airship instance is returned in shared.