ConsumerMapView

public class ConsumerMapView extends FrameLayout

A custom map view that changes its appearance based on the currently shown Session. The map is contained in a FrameLayout that can be added to an XML layout where the parent is a Fragment or FragmentActivity which provides LifecycleOwner to the MapView.

The associated ConsumerGoogleMap is returned in a callback registered by calling getConsumerGoogleMapAsync(ConsumerMapReadyCallback, Fragment, GoogleMapOptions) or getConsumerGoogleMapAsync(ConsumerMapReadyCallback, FragmentActivity, GoogleMapOptions). The callback returns the ConsumerGoogleMap which provides access to Google Maps Android API for this view. The ConsumerController is then available by calling ConsumerGoogleMap.getConsumerController().

Inherited Constant Summary

Inherited Field Summary

Public Constructor Summary

ConsumerMapView(Context context)
Initializes ConsumerGoogleMap with the context.
ConsumerMapView(Context context, AttributeSet attrs)
Initializes ConsumerGoogleMap with the context and attribute set.
ConsumerMapView(Context context, AttributeSet attrs, int defStyleAttr)
Initializes ConsumerGoogleMap with the context and attribute set, and attribute reference.
ConsumerMapView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Initializes ConsumerGoogleMap with the context and attribute set, and attribute and style resource references.

Public Method Summary

void
getConsumerGoogleMapAsync(ConsumerGoogleMap.ConsumerMapReadyCallback callback, FragmentActivity fragmentActivity, GoogleMapOptions googleMapOptions)
Access ConsumerGoogleMap associated with this ConsumerMapView contained in a FragmentActivity.
void
getConsumerGoogleMapAsync(ConsumerGoogleMap.ConsumerMapReadyCallback callback, Fragment fragment, GoogleMapOptions googleMapOptions)
Access ConsumerGoogleMap associated with this ConsumerMapView contained in a Fragment.
void
onEnterAmbient(Bundle bundle)
You must call this from the corresponding method of the parent activity or fragment.
void
onExitAmbient()
You must call this from the corresponding method of the parent activity or fragment.
void
onLowMemory()
You must call this from the corresponding method of the parent activity or fragment.
void
onSaveInstanceState(Bundle outState)
You must call this from the corresponding method of the parent activity or fragment.

Inherited Method Summary

Public Constructors

public ConsumerMapView (Context context)

Initializes ConsumerGoogleMap with the context.

Parameters
context The context.

public ConsumerMapView (Context context, AttributeSet attrs)

Initializes ConsumerGoogleMap with the context and attribute set.

Parameters
context The context.
attrs The AttributeSet.

public ConsumerMapView (Context context, AttributeSet attrs, int defStyleAttr)

Initializes ConsumerGoogleMap with the context and attribute set, and attribute reference.

Parameters
context The context.
attrs The attribute set.
defStyleAttr The attribute reference.

public ConsumerMapView (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Initializes ConsumerGoogleMap with the context and attribute set, and attribute and style resource references.

Parameters
context The context.
attrs The attribute set.
defStyleAttr The attribute reference.
defStyleRes The style resource reference.

Public Methods

public void getConsumerGoogleMapAsync (ConsumerGoogleMap.ConsumerMapReadyCallback callback, FragmentActivity fragmentActivity, GoogleMapOptions googleMapOptions)

Access ConsumerGoogleMap associated with this ConsumerMapView contained in a FragmentActivity.

Must be called during FragmentActivity.onCreate() of the FragmentActivity. The ConsumerGoogleMap will be destroyed when the FragmentActivity is destroyed, both ConsumerController and ConsumerGoogleMap should no longer be referenced to avoid memory leaks.

Parameters
callback Callback returns ConsumerGoogleMap.
fragmentActivity Parent FragmentActivity of this view.
googleMapOptions Options supplied to the MapView.MapView(Context, GoogleMapOptions) constructor and may impact how the Consumer SDK functions. If null, default GoogleMapOptions are used.

public void getConsumerGoogleMapAsync (ConsumerGoogleMap.ConsumerMapReadyCallback callback, Fragment fragment, GoogleMapOptions googleMapOptions)

Access ConsumerGoogleMap associated with this ConsumerMapView contained in a Fragment.

Must be called during Fragment.onViewCreated(View, Bundle) of the fragment.

When the Fragment is destroyed, both ConsumerController and ConsumerGoogleMap should no longer be referenced to avoid memory leaks.

Parameters
callback Callback returns ConsumerGoogleMap.
fragment Parent Fragment of this view.
googleMapOptions Options supplied to the MapView.MapView(Context, GoogleMapOptions) constructor and may impact how the Consumer SDK functions. If null, default GoogleMapOptions are used.

public void onEnterAmbient (Bundle bundle)

You must call this from the corresponding method of the parent activity or fragment.

Parameters
bundle The bundle with the ambient details.

public void onExitAmbient ()

You must call this from the corresponding method of the parent activity or fragment.

public void onLowMemory ()

You must call this from the corresponding method of the parent activity or fragment.

public void onSaveInstanceState (Bundle outState)

You must call this from the corresponding method of the parent activity or fragment.

Parameters
outState The bundle with the state before the view is destroyed.