public abstract class

Autopilot

extends Object
implements UAirship.OnReadyCallback
java.lang.Object
   ↳ com.urbanairship.Autopilot

Class Overview

Autopilot allows you to defer calling UAirship.takeOff until after the application has been created. Typically, UAirship.takeOff must be called in Application.onCreate() so that the Urban 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.

Extend this class and implement the abstract methods, then call Autopilot.automaticTakeOff() at all application entry points (i.e., in the onCreate() method of all registered Broadcast Receivers, Activities and Services). The default AirshipConfigOptions will be created from the airshipconfig.properties file from the assets. To provide a custom AirshipConfigOptions, override createAirshipConfigOptions(Context).

Your subclass must not be abstract and may provide a default constructor that will be invoked with Class.newInstance().

Add an entry to the application block of your manifest containing the fully qualified class name of your Autopilot implementation. The meta-data name must be set to "com.urbanairship.autopilot" (Autopilot.AUTOPILOT_MANIFEST_KEY). e.g.,

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

If your app uses Proguard obfuscation, you will need to add an exclusion to proguard.cfg for your Autopilot class:

-keep public class * extends com.urbanairship.Autopilot

Summary

Constants
String AUTOPILOT_MANIFEST_KEY The name of the AndroidManifest meta-data element used to hold the fully qualified class name of the application's Autopilot implementation.
Public Constructors
Autopilot()
Public Methods
static void automaticTakeOff(Context context)
Starts the auto pilot takeOff process.
synchronized static void automaticTakeOff(Application application)
Starts the auto pilot takeOff process.
AirshipConfigOptions createAirshipConfigOptions(Context context)
Implement this method to provide AirshipConfigOptions for takeOff.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.urbanairship.UAirship.OnReadyCallback

Constants

public static final String AUTOPILOT_MANIFEST_KEY

The name of the AndroidManifest meta-data element used to hold the fully qualified class name of the application's Autopilot implementation.

Constant Value: "com.urbanairship.autopilot"

Public Constructors

public Autopilot ()

Public Methods

public static void automaticTakeOff (Context context)

Starts the auto pilot takeOff process. This method must be called at every application entry point (e.g., the onCreate() method of all broadcast receivers, launch activities and services.).

Parameters
context The application context.

public static synchronized void automaticTakeOff (Application application)

Starts the auto pilot takeOff process. This method must be called at every application entry point (e.g., the onCreate() method of all broadcast receivers, launch activities and services.).

Parameters
application The application.

public AirshipConfigOptions createAirshipConfigOptions (Context context)

Implement this method to provide AirshipConfigOptions for takeOff. This method may return null if the config should be loaded asynchronously from the airshipconfig.properties file.

Returns
  • The launch options. If null, the options will be loaded from the airshipconfig.properties file.