Places

public final class Places extends Object

Entry point for the Places API.

Public Method Summary

synchronized static PlacesClient
createClient(Context context)
Gets an instance of PlacesClient for a given Context.
static void
initialize(Context applicationContext, String apiKey)
Initializes Places for the given application context with the given API key.
synchronized static void
initialize(Context applicationContext, String apiKey, Locale locale)
Initializes Places for the given application context with the given API key and Locale.
synchronized static boolean
isInitialized()
Returns whether or not Places has been initialized.

Inherited Method Summary

Public Methods

public static synchronized PlacesClient createClient (Context context)

Gets an instance of PlacesClient for a given Context.

Call initialize(Context, String) or initialize(Context, String, Locale) before calling this method.

Parameters
context
Throws
IllegalStateException If Places hasn't been initialized first (see initialize(Context, String) or initialize(Context, String, Locale)).

public static void initialize (Context applicationContext, String apiKey)

Initializes Places for the given application context with the given API key.

All Places API responses are localized using the device's locale. This method should only be called once prior to using the Places API. You may call this method again to update the API key used; if so, all widgets and instances of PlacesClient will now use this new key.

Parameters
applicationContext The application context in which the Places API will be used in.
apiKey The Places API key.
Throws
IllegalArgumentException If the apiKey is empty.

public static synchronized void initialize (Context applicationContext, String apiKey, Locale locale)

Initializes Places for the given application context with the given API key and Locale.

This method should only be called once prior to using the Places API. You may call this method again to update the API key and locale used; if so, all widgets and instances of PlacesClient will now use these new values.

Parameters
applicationContext The application context in which the Places API will be used in.
apiKey The Places API key.
locale The locale in which Places API responses will be localized. If null, the device locale at the point of request is used.
Throws
IllegalArgumentException If the apiKey is empty.

public static synchronized boolean isInitialized ()

Returns whether or not Places has been initialized.

Kirim masukan tentang...

Places SDK for Android