ConsumerApi

public class ConsumerApi extends Object

Entry point for the Consumer Ridesharing SDK. ConsumerApi is a singleton. Use initialize(Context, String, AuthTokenFactory) to get an instance.

Public Method Summary

void
cleanUp()
Clean up the internal state of the ConsumerApi.
static String
getConsumerSDKVersion()
Returns the current Consumer SDK version.
static Task<ConsumerApi>
getInstance()
Returns a task to asynchronously retrieve the singleton instance of the Consumer API once the instance has been initialized by a call to initialize(Context, String, AuthTokenFactory).
List<String>
getMissingPermissions()
If any permissions are missing, returns a list of them; otherwise, returns an empty list.
static String
getSDKSessionId()
Returns the current SDK session ID.
ConsumerTripManager
getTripManager()
This method is deprecated. Use getTripModelManager() instead.
TripModelManager
getTripModelManager()
Returns the TripModelManager instance.
static Task<ConsumerApi>
initialize(Context context, AuthTokenFactory accessTokenFactory, ConsumerApiOptions options)
Initialize the singleton instance of the Consumer API.
static Task<ConsumerApi>
initialize(Context context, String providerId, AuthTokenFactory accessTokenFactory)
Initialize the singleton instance of the Consumer API.
static void
setAbnormalTerminationReportingEnabled(boolean enabled)
Enables/disables reporting abnormal SDK terminations such as the app crashes while the SDK is still running.

Inherited Method Summary

Public Methods

public void cleanUp ()

Clean up the internal state of the ConsumerApi. This should be called when the API is no longer needed.

public static String getConsumerSDKVersion ()

Returns the current Consumer SDK version.

public static Task<ConsumerApi> getInstance ()

Returns a task to asynchronously retrieve the singleton instance of the Consumer API once the instance has been initialized by a call to initialize(Context, String, AuthTokenFactory).

Returns
  • A Task with the instance of ConsumerApi.

public List<String> getMissingPermissions ()

If any permissions are missing, returns a list of them; otherwise, returns an empty list.

Returns
  • list of missing permissions List

public static String getSDKSessionId ()

Returns the current SDK session ID.

public ConsumerTripManager getTripManager ()

This method is deprecated.
Use getTripModelManager() instead.

Returns the ConsumerTripManager instance.

public TripModelManager getTripModelManager ()

Returns the TripModelManager instance.

public static Task<ConsumerApi> initialize (Context context, AuthTokenFactory accessTokenFactory, ConsumerApiOptions options)

Initialize the singleton instance of the Consumer API. This is an asynchronous method. The task result will contain the ConsumerAPI instance. Binds the ConsumerService to the application context which is retrieved from the context argument. Subsequent calls to initialize will ignore the providerId if the service is already bound.

Must be called in order for getInstance() ()} to successfully return an instance.

Parameters
context Used to retrieve the application context, which will be bound to the ConsumerService.
accessTokenFactory A AuthTokenFactory for retrieving tokens.
options Options class that contains configuration information.
Returns
  • A Task with the instance of ConsumerApi.

public static Task<ConsumerApi> initialize (Context context, String providerId, AuthTokenFactory accessTokenFactory)

Initialize the singleton instance of the Consumer API. This is an asynchronous method. The task result will contain the ConsumerAPI instance. Subsequent calls to initialize will ignore the providerId if the service is already bound.

Must be called in order for getInstance() ()} to successfully return an instance.

Parameters
context Used to retrieve the application context, which will be bound to the ConsumerService.
providerId The provider's ID. The ID is added to FleetEngine requests for authorization.
accessTokenFactory A AuthTokenFactory for retrieving tokens.
Returns
  • A Task with the instance of ConsumerApi.

public static void setAbnormalTerminationReportingEnabled (boolean enabled)

Enables/disables reporting abnormal SDK terminations such as the app crashes while the SDK is still running.

This allows Google to improve SDK stability when applicable.

Note: The default is true the value must be updated before any SDK usage to have effect.

Parameters
enabled whether abnormal SDK terminations should be reported.