Class OfflineRegionSelector
- java.lang.Object
-
- com.mapbox.mapboxsdk.plugins.offline.OfflineRegionSelector
-
public class OfflineRegionSelector extends java.lang.ObjectWhile the offline plugin includes a service for optimally launching an offline download session, the plugin also includes UI components which also assist in providing a way for your app users to select the region in which they'd like to download the region they desire.This specific class is used to build an intent which launches the
OfflineActivitywhich provides your users with a way to define the region which they'd like to download. This includes automatically providing the region definition with a name; Whether that's the default name or the name of the region the map's camera position is currently located.The provided Intent builder in this class should be built with the options you would like to provide, then passed into the
Activity.startActivityForResult(Intent, int)or related methods. Inside the same activity being used to launch this activity you'll need to@OverrideActivity.onActivityResult(int, int, Intent)and use the provided static methods also provided in this class.Note that if you are using this exclusively inside your app with a Mapbox Map not already being used somewhere else, you'll need to provide a Mapbox access token by overriding your applications
onCreatemethod and placingcom.mapbox.mapboxsdk.Mapbox#getInstance(Context, String)inside the override method.- Since:
- 0.1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOfflineRegionSelector.IntentBuilderUseful for building anIntentwhich can be used to launch theOfflineActivityallowing your app user to select a region which they'd like to download.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static OfflineDownloadOptionsgetOfflineDownloadOptions(android.content.Intent data, byte[] metadata)Use this method to take the returningIntentdata and construct aOfflineDownloadOptionsinstance which can be used for starting a new offline region download.static OfflineDownloadOptionsgetOfflineDownloadOptions(android.content.Intent data, NotificationOptions notificationOptions)Use this method to take the returningIntentdata and construct aOfflineDownloadOptionsinstance which can be used for starting a new offline region download.static OfflineDownloadOptionsgetOfflineDownloadOptions(android.content.Intent data, NotificationOptions notificationOptions, byte[] metadata)Use this method to take the returningIntentdata and construct aOfflineDownloadOptionsinstance which can be used for starting a new offline region download.static com.mapbox.mapboxsdk.offline.OfflineRegionDefinitiongetRegionDefinition(android.content.Intent data)Returns theOfflineRegionDefinitionwhich was created when the user was inside theOfflineActivity.static java.lang.StringgetRegionName(android.content.Intent data)TheOfflineActivityclass will try to provide a region name which is either the default region naming string or, depending on the map's camera position and where it is positioned over the map.
-
-
-
Method Detail
-
getOfflineDownloadOptions
public static OfflineDownloadOptions getOfflineDownloadOptions(android.content.Intent data, byte[] metadata)
Use this method to take the returningIntentdata and construct aOfflineDownloadOptionsinstance which can be used for starting a new offline region download.- Parameters:
data- theActivity.startActivityForResult(Intent, int)which this method should be used in provides the returning intent which should be provided in this parammetadata- Add additional metadata to theOfflineRegionDefinition, note to make sure not to override the region definition name if you still wish to use it- Returns:
- a new
OfflineDownloadOptionsinstance which can be used to launch the download service usingOfflinePlugin.startDownload(OfflineDownloadOptions) - Since:
- 0.1.0
-
getOfflineDownloadOptions
public static OfflineDownloadOptions getOfflineDownloadOptions(android.content.Intent data, NotificationOptions notificationOptions)
Use this method to take the returningIntentdata and construct aOfflineDownloadOptionsinstance which can be used for starting a new offline region download.- Parameters:
data- theActivity.startActivityForResult(Intent, int)which this method should be used in provides the returning intent which should be provided in this paramnotificationOptions- theNotificationOptionsobject you've constructed to be used when launching the offline region download service.- Returns:
- a new
OfflineDownloadOptionsinstance which can be used to launch the download service usingOfflinePlugin.startDownload(OfflineDownloadOptions) - Since:
- 0.1.0
-
getOfflineDownloadOptions
public static OfflineDownloadOptions getOfflineDownloadOptions(android.content.Intent data, NotificationOptions notificationOptions, byte[] metadata)
Use this method to take the returningIntentdata and construct aOfflineDownloadOptionsinstance which can be used for starting a new offline region download.- Parameters:
data- theActivity.startActivityForResult(Intent, int)which this method should be used in provides the returning intent which should be provided in this paramnotificationOptions- theNotificationOptionsobject you've constructed to be used when launching the offline region download service.metadata- Add additional metadata to theOfflineRegionDefinition, note to make sure not to override the region definition name if you still wish to use it- Returns:
- a new
OfflineDownloadOptionsinstance which can be used to launch the download service usingOfflinePlugin.startDownload(OfflineDownloadOptions) - Since:
- 0.1.0
-
getRegionDefinition
public static com.mapbox.mapboxsdk.offline.OfflineRegionDefinition getRegionDefinition(android.content.Intent data)
Returns theOfflineRegionDefinitionwhich was created when the user was inside theOfflineActivity.- Parameters:
data- theActivity.startActivityForResult(Intent, int)which this method should be used in provides the returning intent which should be provided in this param- Returns:
- the
OfflineRegionDefinitionwhich was created inside theOfflineActivity - Since:
- 0.1.0
-
getRegionName
public static java.lang.String getRegionName(@NonNull android.content.Intent data)TheOfflineActivityclass will try to provide a region name which is either the default region naming string or, depending on the map's camera position and where it is positioned over the map.- Parameters:
data- theActivity.startActivityForResult(Intent, int)which this method should be used in provides the returning intent which should be provided in this param- Returns:
- either a string containing the default region name or the actual region name which the map's camera position was last placed over
- Since:
- 0.1.0
-
-