Giter VIP home page Giter VIP logo

mapbox / mapbox-plugins-android Goto Github PK

View Code? Open in Web Editor NEW
240.0 125.0 119.0 4.18 MB

Mapbox Android Plugins are a collection of libraries that extend our other SDKs, helping you design powerful mapping features while the plugins handle most of the heavy lifting.

Home Page: https://www.mapbox.com/android-docs/plugins/overview/

License: BSD 2-Clause "Simplified" License

Java 83.53% Makefile 0.15% Kotlin 6.94% JavaScript 1.81% EJS 7.56%
mapbox android maps

mapbox-plugins-android's Introduction


Mapbox Plugins

Plugins are single-purpose libraries built on top of the Mapbox Maps SDK for Android that you can include in your apps like any other Android dependency


Mapbox Plugins for Android

Plugins are single-purpose libraries built on top of the Mapbox Maps SDK for Android that you can include in your apps like any other Android dependency. You'll find documentation for each plugin on our Android documentation website. A full list of the current plugins is available below.

Available Plugins

Installing a plugin

By using a plugin, you also have to include the Mapbox Maps SDK for Android which means that you'll need to setup your project to use the Maps SDK if you haven't already. Head over to the overview page for the Maps SDK to learn more.

Note that depending on the plugin you add, there might be required permissions and additional setup steps. You'll find more information on whether or not more configuration steps are involved when looking at the specific plugin documentation.

  1. Start Android Studio
  2. Open up your application's build.gradle
  3. Make sure that your project's minSdkVersion is at API 14 or higher
  4. Under dependencies, add a new build rule for the latest plugin version you are trying to use.
repositories {
  mavenCentral()
  maven {
    url 'https://api.mapbox.com/downloads/v2/releases/maven'
    authentication {
      basic(BasicAuthentication)
    }
    credentials {
      username "mapbox"
      password = "SDK_REGISTRY_TOKEN"
    }
  }
}

dependencies {
  implementation 'com.mapbox.mapboxsdk:{PLUGIN_NAME}-v{MAJOR_MAPS_SDK_VERSION_NUMBER}:PLUGIN_VERSION_NUMBER'
}
  1. Replace SDK_REGISTRY_TOKEN with a Mapbox access token that has the downloads scope

Plugin artifacts are versioned based on the major release of the Maps SDK for Android, which means, that each artifact's name has a major version of the Maps SDK it's compatible with appended.

  1. Click the Sync Project with Gradle Files near the toolbar in Studio.

Maps SDK compatibility

The Mapbox Plugins for Android are heavily dependent on the major semantic versioning number of the Maps SDK. They either won't compile or hide runtime bugs when paired with a different major version of the Maps SDK. Each plugin's dependency name has a vX suffix which states the major version of the Maps SDK that the plugin is compatible with. This suffix makes the transition between versions easier and more educated without the need to jump into changelogs and compare repositories.

Help and Usage

A plugin is simply a library module built on top of the Mapbox Maps SDK for Android. Plugins can be easy to use. Currently, we are not requiring plugins to register themselves or to implement any specific interfaces so that they're simple to consume.

Test app

This repository includes an app with examples showing how you can use each plugin.

This might change in the future as we build more plugins and learn how you use them. We'd love to hear your feedback.

Why Plugins?

Splitting specific functionality into plugins makes our Maps SDK lighter and nimble for you to use, and it also lets us iterate faster. We can release plugins more often than the SDK, which requires a slower pace due to its larger codebase.

The Mapbox Android team creates plugins but this plugins repository is an open-source project similar to the various Mapbox SDKs for Android. Plugins' lightweight nature makes them much easier for you and anyone else to contribute rather than trying to add the same feature to the more robust Maps SDK. The Mapbox team can also more easily accept contributed plugins and keep the plugin list growing.

Contributing

We welcome contributions to this plugin repository!

If you're interested in building and sharing your own plugin, please read the contribution guide to learn how to get started.

mapbox-plugins-android's People

Contributors

1ec5 avatar arnekaiser avatar danesfeder avatar dependabot[bot] avatar ericrwolfe avatar guardiola31337 avatar gustron12 avatar kiryldz avatar langsmith avatar lukaspaczos avatar mdakram avatar ottylab avatar pengdev avatar ph0tonic avatar romatroskin avatar sebastienrouif avatar snkashis avatar theel0ja avatar tobrun avatar trevorhalvorson avatar zhao-gang avatar zugaldia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mapbox-plugins-android's Issues

TrackingSettings Plugin

This plugin aims at extracting code from the main SDK related to tracking settings. These settings allow developers to track the user location and bearing changes. Atm a lot of boilerplate code is used to take these settings and this would cleanup the codepaths there though this plugin is going to be harder to extract.

Traffic plugin

We'd like to add a traffic plugin that lets you add a traffic layer to any Mapbox basemap. To do that, we could use runtime styling.

We'd also like to add a sample activity to the test app that lets you switch between a few basemaps, including a toggle to turn traffic on and off.

cc: @ericrwolfe

Accuracy circle layer

mapbox/mapbox-gl-native#9426 looks to add support for circle pitch alignment in runtime styling thus unlocking the ability to simplify the logic for the accuracy ring and animate it.

We are currently using a fill layer since it lays flat even when the maps tilted but with this property unlocked it should become a circle layer. Technically all the layer really could become a circle layer but for the customizability available as far as using drawable for the location icon, I'm thinking they should remain symbol layers.

cc: @tobrun @zugaldia

LocationPicker plugin

a separate activity for picking the location from the Mapbox map & return a latitude, longitude and an address(if exist the reverse geocoding services ) based on the location picked.
with options for a center of the map, zoom and search view for searching location by text.

Navigation plugin

Currently we bundle the Navigation SDK for Android (https://github.com/mapbox/mapbox-navigation-android) with no explicit dependencies on the Map SDK. This makes the Navigation SDK light-weight, well-contained, and suitable of a wide range of applications.

However, there're some specific features that a navigation app would build on top of the Maps SDK (like route layers updated as the user navigate, or traffic #4). Let's bring this functionality as a navigation-focused plugin.

cc: @mapbox/navigation

Building Plugin: animated FillExtrusion while zooming

A cool feature that was implemented as an example for extrusions is animating the FillExtrusion while zooming from @incanus. The iOS code for that is:

 func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {
        if  let composite       = style.source(withIdentifier: "composite"),
            let building        = style.layer(withIdentifier: "building") as? MGLFillStyleLayer,
            let building_line   = style.layer(withIdentifier: "building-line"),
            let airport_labels  = style.layer(withIdentifier: "airport-label") {
            building.isVisible = false
            building_line.isVisible = false
            let extrusions = MGLFillExtrusionStyleLayer(identifier: "extrusions", source: composite)
            extrusions.minimumZoomLevel = 15
            extrusions.sourceLayerIdentifier = "building"
            extrusions.fillExtrusionColor = building.fillColor
            extrusions.fillExtrusionOpacity = MGLStyleValue(rawValue: 0.75)
            extrusions.fillExtrusionHeight = MGLStyleValue(interpolationMode: .exponential,
                                                           compositeStops: [
                                                               15: [
                                                                   0: MGLStyleValue(rawValue: 0)
                                                               ],
                                                               16: [
                                                                   0:    MGLStyleValue(rawValue: 0),
                                                                   1000: MGLStyleValue(rawValue: 1000)
                                                               ]
                                                           ],
                                                           attributeName: "height",
                                                           options: nil)
            style.insertLayer(extrusions, above: airport_labels)
        }
    }

This is currenlty missing from the Building plugin and would be a nice to have.

Android Wear Plugin

Instead of offering android wear functionality inside the Maps SDK directly, we should use this plugin system for those looking to implement our maps inside wearables. This would give the added benefit of being able to use the Wear dependencies offered by Google.

Marker Cluster Plugin

We could make a reimplementation of the clustering algorithm found in Google maps utils library. The code for this is apache licensed. This plugin should automatically support clustering of Markers and MarkerViews.

Cancel location animation if distance is far enough

Instead of animating the location layer icon to a new location far away from the origin, instantly moving or speeding up the animation might be necessary. Otherwise, it gives the appearance that the icon is missing from the map.

GeoJson Loader

I want to create plugin for loading GeoJson file from assets, path or url. Add point, polyline and polygon of GeoJson on the map with item click listener.
@tobrun @langsmith

Document plugins

Once we're able to publish the plugins to Maven #3 and once we have the first plugin ready #4 (both are happening shortly) we'll want to make this repository available for anyone to use. For this to happen we have to document:

  • the list of available plugins with descriptions
  • information on how to install them via Maven/Gradle
  • examples on how to use them (reference implementation is in the test app)
  • information on how to contribute a plugin

Initially, we can use the README file in this repo but, ideally, we'll integrate this documentation with the rest of the Android docs (new Plugins tab in https://www.mapbox.com/android-docs?).

@langsmith Could you add to OP anything I might have missed and run point on this?

@ericrwolfe Do we have a similar ticket for iOS? Do we have any comms plans in the pipeline?

cc: @cammace @tobrun

Light API on Building Plugin

With mapbox/mapbox-gl-native#9013, we added binding integration for the GL style specification concept of Light. This API allows to change the global light source used for fill extrusion layers.

Instead of exposing the API cfr to the style spec:

  • color
  • intensity
  • anchor
  • position (radian coordinate, azimuth angle & polar angle)

We can expose some facility API around the concept of the placement of the Sun during the day.

light conditions in the morning, midday and evening?

cc @mapbox/android

Offline Plugin

This plugin would be a high level wrapper around offline API.
More information and context in mapbox/mapbox-gl-native#7289.

  • download a region
    • show notification while downloading
      • cancel button
      • customisation configuration
    • handle multiple requests
      • hook into onStartCommand
    • allow binding/unbinding to forward any errors?
    • handle connection state change events
  • bounds selection dialog
  • list offline regions
  • remove offline regions
  • change name offline region
  • update offline region content?
  • navigation?
  • searching for map data?
  • only download on wifi configuration
  • save maps only to SD card configuration?

Makefile javadoc task

Each plugin will have separate javadoc which needs to be generated with each plugin release. Note that release of plugins are independent of each other.

cc: @zugaldia @langsmith

Building plugin

With the 5.1.0 release we are introducing FillExtrusionLayer. One of the features possible with this, is showing buildings on top of the map by using OSM data. Atm, integrating this feature into your map requires developers to write boiler plate code. Similar to our Traffic plugin, I'm proposing to have a simple facility API so developers aren't required to hook into the runtime API and can show buildings on a map by just calling a single method.

Note that Google however exposes this functionality directly in their SDK. Since this feature for us would be a high level implementation on top of a low level implementation. I'm suggesting putting it into a plugin instead.

WIP can be followed in #26

cc @mapbox/android @pveugen @ericrwolfe

TensorFlow plugin

There's a flavor of TensorFlow for mobile (example code here). Additionally, it was announced during I/O a new effort, TensorFlow Lite, that's gonna improve the mobile experience further. I'd love to see a plugin that uses a pre-trained TensorFlow model to provide some additional functionality on top of the map or our services.

@mapbox/android please keep an eye open for interesting models out there that we could apply here.

LocationLayerPlugin accurary

**Platform:Android 6.0
**Mapbox SDK version:5.1.2

1.The accuracy part of LocationLayerPlugin doesn't shown, event changing to customized style;
2.If the accuracy part can be seen, will it change its shape along with the tilt?

Localization plugin

We should have a plugin that automatically localizes map labels into the user’s preferred language. There’s already a robust implementation of this feature in Objective-C targeting the macOS SDK that could be ported to the Android SDK:

https://github.com/mapbox/mapbox-gl-native/blob/cc1ea759a681cadcfd06fd7bdda79ca6deb38c62/platform/macos/app/MapDocument.m#L346-L393
https://github.com/mapbox/mapbox-gl-native/blob/cc1ea759a681cadcfd06fd7bdda79ca6deb38c62/platform/macos/app/MGLVectorSource+MBXAdditions.m

/ref mapbox/mapbox-gl-native#7031
/cc @tobrun @langsmith @ericrwolfe

CI build for each plugin

To allow scale on this repo, the CI build should be decoupled in having a CI build for each plugin. This allows us to have more finer grain control over builds/releases/testing and treats each plugin as its own project.

KML/GPX Parser Plugin

These two common GPS files are widely used across the internet, often shared via email and social media. It would be excellent to have a plugin which parses the GPX or KML into GeoJSON so that it can be imported onto the map. The key reason for a plugin would be so the GPS file could be loaded onto the map quickly, without the need for an API request to an external server to convert the file (which would take a long time) and without the need of an internet connection.

Mapbox has the https://github.com/mapbox/togeojson library, it just needs to be ported here to a native plugin.

Once implemented the developer can use native OS functionality to launch his/her app via "Open with" when a GPS file is opened on a device.

Once implemented, the developer can implement the native "open with" for their app for GPX/KML file extensions. The app will load and run a function (sorry, I don't know what this is called in Android) to parse the file, which this plugin will parse/convert, then the GeoJSON data will be available to be loaded onto any layer after the map is setup.

Release v0.1

Now that the first plugin has been created (traffic! 🎉) let's make it public for anyone to use.

For this to happen, we need to do the following:

@mapbox/android please add to OP anything I might have missed.

Scheduled release build failing + notify team on slack

It seems that the scheduled release build is failing due to rotated AWS access:

+------------------------------------------------------------------------------+

| (1) Fetch GPG Secring For SDK Signing                                        |
+------------------------------------------------------------------------------+
| id: script                                                                   |
| version: 1.1.4                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: bash                                                                |
| time: 2017-06-20T04:04:23Z                                                   |
+------------------------------------------------------------------------------+
|                                                                              |
fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden
|                                                                              |
+---+---------------------------------------------------------------+----------+
| x | Fetch GPG Secring For SDK Signing (exit code: 1)              | 1.15 sec |
+---+---------------------------------------------------------------+----------+
| Issue tracker: https://github.com/bitrise-io/steps-script/issues             |
| Source: https://github.com/bitrise-io/steps-script                           |
+---+---------------------------------------------------------------+----------+

Additionally we weren't notified of the failure in slack. I'm proposing to add an@android_team mention in the slack message that is posted as part of our CI build.

cc @mapbox/android

MarkerView Plugin

This plugin would move all logic found related to MarkerView from the Mapbox GL native SDK to a separate plugin. This would allow us to have independent releases from the main sdk and limit the exposed api there. This change would result in a SemVer change in main SDK.

Fatal signal crash when used Google Location Engine and Location Plugin

Hello,
When I use custom location engine (GoogleLocationEngine) сrash occurs on Android.

Plugin version :
0.1.0
0.2.0-SNAPSHOT

Logcat:

F/libc    ( 3054): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 3054 (.reverllc.rever)
I/DEBUG   (13278): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (13278): Build fingerprint: 'samsung/jflteuc/jflteatt:5.0.1/LRX22C/I337UCUGOK2:user/release-keys'
I/DEBUG   (13278): Revision: '10'
I/DEBUG   (13278): ABI: 'arm'
I/DEBUG   (13278): pid: 3054, tid: 3054, name: .reverllc.rever  >>> com.reverllc.rever <<<
I/DEBUG   (13278): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
I/DEBUG   (13278):     r0 00000000  r1 be8217b4  r2 be8217e0  r3 9c7d3179
I/DEBUG   (13278):     r4 be8217b4  r5 be8217b4  r6 a030f77c  r7 be821768
I/DEBUG   (13278):     r8 8e778b00  r9 be8217e0  sl be821880  fp b4f07800
I/DEBUG   (13278):     ip 9ca11cc4  sp be8216d8  lr 9c79a827  pc 9c7d3194  cpsr 800f0030
I/DEBUG   (13278): 
I/DEBUG   (13278): backtrace:
I/DEBUG   (13278):     #00 pc 00195194  /data/app/com.reverllc.rever-1/lib/arm/libmapbox-gl.so
I/DEBUG   (13278):     #01 pc 0015c825  /data/app/com.reverllc.rever-1/lib/arm/libmapbox-gl.so
I/DEBUG   (13278):     #02 pc 0015dc3f  /data/app/com.reverllc.rever-1/lib/arm/libmapbox-gl.so
I/DEBUG   (13278):     #03 pc 000c2beb  /data/app/com.reverllc.rever-1/lib/arm/libmapbox-gl.so
I/DEBUG   (13278):     #04 pc 000bd8b3  /data/app/com.reverllc.rever-1/lib/arm/libmapbox-gl.so
I/DEBUG   (13278):     #05 pc 000bfd5b  /data/app/com.reverllc.rever-1/lib/arm/libmapbox-gl.so
I/DEBUG   (13278):     #06 pc 000a2541  /system/lib/libart.so (art_quick_generic_jni_trampoline+32)
I/DEBUG   (13278):     #07 pc 00314694  /dev/ashmem/dalvik-alloc space (deleted)

To reproduce the bug, you need to zoom map. Sometimes a bug is reproduced immediately. Sometimes You need to quickly zoom (in-out) map. (by fingers)

I created sample app - https://github.com/giperwlad/mapboxLocationPluginSample
Bug was reproduced on real devices (for example Samsung S6,S4).
I very much hope that you can help solve this problem.
Thanks.

UPDATE
Crash is reproduced with LOST LocationEngine too!

UPDATE
Crash is reproduced when user location changes and marker moves

Symbol plugin

Plugin proposal to have an object oriented wrapper around symbol layers. These wrappers should be generated from the style specification. This allows to automatically include new style spec features when they land on the Android SDK.

Scale Widget Plugin

A scale widget plugin allows to place a scalebar on a Mapbox map.

iOS is bringing this feature to their SDK in mapbox/mapbox-gl-native#7631. We could potentially implement this as a plugin instead. This fits in our to decouple our map SDK more into smaller pluggable components.

cc @zugaldia

Update ReadMe

With the merge of Location layer, we now offer an additional plugin. We also are close to merging to building plugin and the traffic plugin has been updated to 0.2.0. These changes need to be reflected in the readme file in this repo.

cc: @langsmith @zugaldia

Runtime Style MyLocationView Plugin

The idea for this plugin is using Runtime Styling to replace current MyLocationView implementation. @cammace started of this work in mapbox/mapbox-gl-native#7516. Instead of merging it to the main SDK, we could also expose this as a plugin and let the SDK rely on it instead. With a SemVer release we could extract the implementation completely in a separate plugin.

Kotlin plugin

This ticket tracks an idea about the language to write the plugin with rather than the actual purpose of the plugin. Considering plugins are well-contained, a plugin would be an ideal place to showcase how to interact with the Maps SDK using only Kotlin.

What do you think @mapbox/android ?

Only add traffic layer above if layer exist

One issue restricting the traffic plugin from working on any platform is the fact that we are trying to add the traffic above "bridge-motorway" but this layer id doesn't exist in every style causing the traffic layers to not get added.

cc: @tobrun @zugaldia

Another locationlayer mode - "static" navigation icon

Ticket as per the contribution guidelines. I'm not fully sure if the word static is the best word to use for this ticket.

The idea is either a setting on top of current NAVIGATION mode or another mode. Where the navigation icon would not move or rotate as it does today. Instead it would be centered and the map/camera would rotate and follow the user.

Iirc the TRACKING_FOLLOW at MyLocationView in Mapbox SDK did the following part but not always pointing upwards on the screen.

Similar to other navigation apps, as it's probably a simpler UI experience for navigation.

Feel free to close this issue. Looking forward for any input from @mapbox/android

I'm pretty sure we are interested in this mode, we currently have a small testing branch with a modified version of this master.

Add callback when compass accuracy is low

Exposing a callback for when the compass accuracy becomes low will allow developers to integrate their own UI (or possibly use ours) to alert the user to recalibrate the sensor.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.