Coder Social home page Coder Social logo

airbnb / airmapview Goto Github PK

View Code? Open in Web Editor NEW
1.9K 165.0 213.0 8.45 MB

A view abstraction to provide a map user interface with various underlying map providers

Home Page: http://airbnb.github.io/AirMapView/

License: Apache License 2.0

HTML 20.52% Java 69.41% CSS 9.96% Kotlin 0.11%
android map airmapview mapbox java google-maps

airmapview's People

Contributors

acq avatar amoljain avatar bleege avatar bmaslakov avatar bobby1i avatar cdeonier avatar felipecsl avatar gpeal avatar jmartinesp avatar jvartanian avatar leonardo2204 avatar lxdvs avatar lxu42 avatar mmdango avatar nwadams avatar omarb97 avatar petzel avatar rohandhruva avatar rossbacher avatar wonginese 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

airmapview's Issues

Map black spots

I'm adapting the example from the repo but when i load the program the map show some black spots and when i zoom in the roads are in black and white

image

Offline maps

Is it possible to use OSM maps stored on device?

MapBox marker pin problem

There is a problem with MapBox marker
when I try to add some bitmap or BitmapDescriptorFactory
algorithm ignores that and show standard pin

What mapping providers are supported?

It looks like just Google maps in native and web-based forms at the moment. I notice there's also a amazon branch, but no info on plans to integrate it into the main lib.

Style map

Is it possible to style the map ?
Using Google Maps is possible to stylize my map according to a Json.

Trying to get in touch regarding a security issue

Hey there!

I'd like to report a security issue but cannot find contact instructions on your repository.

If not a hassle, might you kindly add a SECURITY.md file with an email, or another contact method? GitHub recommends this best practice to ensure security issues are responsibly disclosed, and it would serve as a simple instruction for security researchers in the future.

Thank you for your consideration, and I look forward to hearing from you!

(cc @huntr-helper)

Google Play services error

I'm getting this error when i run the app on some devices :

App is having trouble with Google Play Services. Please try again

Google Maps JavaScript API warning: NoApiKeys

Hi,

For some reason I can't get to make the JavaScript Google maps to work.

I created a totally new account in Google Cloud Console and created all the necessary setup including the billing system.

For some reason the Web Maps are still throwing this Google Maps JavaScript API warning: NoApiKeys exception and the map is showing up with a dark grey overlay on top of it, stating that the maps is only for Development Purposes.

I am using the sample app and I am getting these same results.

Blank Map (Web)

Hello,

I tried the code below in the Emulator as well as on real device. Both the devices doesn't have Google Play Services installed so a web based version of map is shown. But for some reason, the map is always blank with just blue color. Attached is the screenshot. Am I missing something?

screen shot 2015-06-09 at 4 39 02 pm

MainActivity.java

mapViewBuilder = new DefaultAirMapViewBuilder(this);
map = (AirMapView) findViewById(R.id.map_view);
map.setOnMapInitializedListener(this);
map.initialize(getSupportFragmentManager());

Layout

<com.airbnb.android.airmapview.AirMapView
android:id="@+id/map_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />

WebView is shown on Kindle but I cant move or do anything

I am working for Properly Inc on our Anrdoid app and since we want to support Kindle and other Android OS variations that dont support the Play Services, I found our guys plugin. We are already using your deeplink plugin too.

But for some reason I cant interact with the Map in the WebView, the log shows ReferenceErrors.
I tried doing things through the AirMapView and the AirMapInterface, nothing helped.

To setup the the plugin for this use I followed your sample project and got it to display.

Do I have to interact with the webmap in another way, or should I use/try MapBox?

Thank you,

Matt

Support for changing map type (e.g. Roadmap, Satellite, Hybrid)

Hi,

Are there plans to add support for switching between map types to the AirMapInterface?

The native GoogleMap object offers the setMapType(int), it would be quite useful if a similar method was exposed via the AirMapInterface. In particular it would be useful to be able to switch between "roadmap" and "satellite" programmatically. As it stands there doesn't appear to be any way to change the default map type, which is Roadmap.

For reference, the map types available via the Google Maps Javascript API are described here:
https://developers.google.com/maps/documentation/javascript/maptypes

Forced asking for location permission

Hey,

looks like the library asks for a location permission on behalf of us. What I'd like to achieve is to ask for this permission on my own.

From what I can see checkLocationPermissions() checks if permission is granted and asks for it if not. This method is used only from setMyLocationEnabled() method. This would be acceptable if, as a workaround, I could pass false to it and avoid asking. Unfortunately in NativeGoogleMapFragment init() method there's a setMyLocationEnabled(true) call which forces asking for permission.

Is this correct or am I missing something?

As for me, the ideal solution would be to completely remove asking for this permission from AirMapView and leave it to developer's decision. Another, that would probably work for most of people, would be to remove setMyLocationEnabled(true) from mentioned init() method.

What do you think?

I have this error in gradle

Error:A problem occurred configuring project ':app'.

Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not find com.amazon.android:amazon-maps-api:2.0.
Searched in the following locations:
https://jcenter.bintray.com/com/amazon/android/amazon-maps-api/2.0/amazon-maps-api-2.0.pom
https://jcenter.bintray.com/com/amazon/android/amazon-maps-api/2.0/amazon-maps-api-2.0.aar
file:/C:/Users/Mirko/AppData/Local/Android/sdk/extras/android/m2repository/com/amazon/android/amazon-maps-api/2.0/amazon-maps-api-2.0.pom
file:/C:/Users/Mirko/AppData/Local/Android/sdk/extras/android/m2repository/com/amazon/android/amazon-maps-api/2.0/amazon-maps-api-2.0.aar
file:/C:/Users/Mirko/AppData/Local/Android/sdk/extras/google/m2repository/com/amazon/android/amazon-maps-api/2.0/amazon-maps-api-2.0.pom
file:/C:/Users/Mirko/AppData/Local/Android/sdk/extras/google/m2repository/com/amazon/android/amazon-maps-api/2.0/amazon-maps-api-2.0.aar
Required by:
Link:app:unspecified > com.airbnb.android:airmapview:1.1.2
Could not find com.google.android.gms:play-services-maps:7.0.0.
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-maps/7.0.0/play-services-maps-7.0.0.pom
https://jcenter.bintray.com/com/google/android/gms/play-services-maps/7.0.0/play-services-maps-7.0.0.jar
file:/C:/Users/Mirko/AppData/Local/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-maps/7.0.0/play-services-maps-7.0.0.pom
file:/C:/Users/Mirko/AppData/Local/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-maps/7.0.0/play-services-maps-7.0.0.jar
file:/C:/Users/Mirko/AppData/Local/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-maps/7.0.0/play-services-maps-7.0.0.pom
file:/C:/Users/Mirko/AppData/Local/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-maps/7.0.0/play-services-maps-7.0.0.jar
Required by:
Link:app:unspecified > com.airbnb.android:airmapview:1.1.2

How to add TouchListener?

TouchListener simply will not work since mapview itself is using touchlistener inside of it. What if we want to detect action up by our own touchlistenr? Please provide solution.

Trigger onMapMarkerClick(id) programatically?

Hello,

I tried to trigger the onMapMarkerClick(1) function programatically, but the marker title and map toolbar is not shown. The marker has to be tapped manually. Is there any way, this can be achieved?

Thanks in advance.

Question

Hi, I know that this is not the correct topic but I would like to know what technologies backend and frontend use to work the map on the web.
I have the doubt that technologies use to be able to work a search engine with a map.
Thank you

Lite Mode

First of all congratulations for the repo, it's fantastic.
I want to show only a bitmap of the map in a section of the app, how can I achieve this?

Thanks in advace

android-maps-utils compatibility

Google provides a utility library named android-map-utils, which includes many features not included directly in Google Maps, like :

  • clustering
  • heat maps
  • GeoJSON support
  • KML support

Obviously, this library expects the APIs from Google Maps, so it cannot work with AirMapView.

Since this library is open-source, I started integrating it in AirMapView. A working demo can be found at this address : https://github.com/acq/AirMapView/tree/map-utils. The only feature that does not work yet is custom tiles (and others require more work, like custom images for markers). Here are some screenshots:



In this proof of concept, several features needed to be added or reworked in order the library to work. This includes ground overlays, custom image markers on web maps, changed APIs (for example: AirMapPolyline), various bug fixes, ...

This code is not ready to be merged, but raises several questions:

  • are you interested in having those features? part of those features?
  • do you want them inside of AirMapView or in their own library (like android-map-utils exists currently), in order to keep AirMapView light?
  • I modified the package of these utils, so this library could exist in the same environment than the "old" android-map-utils. What package should be used?
  • are you open to the modification of current AirMapView APIs?

Thanks!

Fail on compile

This return a error when I try to compile.
The build of gradle works well, but the app, not.

Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 2

Question: Can't get webview sample to work

Hi guys, I'm trying to get the Google Maps web view to work but all I can see is a blank blue screen from a failed-to-load Google map. I suspected maybe the API Key was not set somehow, I get that warning in the logs:

11-17 06:30:41.071 2366-2366/mobi.hopr I/chromium: [INFO:CONSOLE(210)] "Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys", source: https://maps.googleapis.com/maps-api-v3/api/js/27/1/util.js (210)

I then downloaded your sample to see what I was doing wrong and noticed that if I set the manifest's com.google.android.maps.v2.API_KEY to empty, the sample still functions completely (native and web view maps). How is this possible? And where is the javascript key actually set for the webview maps? Not sure what I could be doing wrong but this might point me in the right direction.

NPE onMapInitialized

Starting at version 1.5.0, we've seen a weird NPE crash in your app:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'com.airbnb.android.airmapview.AirMapInterface com.airbnb.android.airmapview.AirMapView.getMapInterface()' on a null object reference
       at br.com.moobie.android.carMaps.CarMapFragment.onMapInitialized(CarMapFragment.java:308)
       at com.airbnb.android.airmapview.AirMapView.onMapLoaded(AirMapView.java:416)
       at com.airbnb.android.airmapview.NativeGoogleMapFragment$1.onMapReady(NativeGoogleMapFragment.java:78)
       at com.google.android.gms.maps.zzaj.zza(Unknown Source)
       at com.google.android.gms.maps.internal.zzaq.onTransact(Unknown Source)
       at android.os.Binder.transact(Binder.java:387)
       at fv.b(:com.google.android.gms.DynamiteModulesB@11745436:20)
       at com.google.android.gms.maps.internal.bf.a(:com.google.android.gms.DynamiteModulesB@11745436:5)
       at com.google.maps.api.android.lib6.impl.bc.run(:com.google.android.gms.DynamiteModulesB@11745436:5)
       at android.os.Handler.handleCallback(Handler.java:739)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:7325)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

I've tried to reproduce the error but I couldn't so far.
In the latter version (1.4.0) everything was working properly, I'm suspecting it might be related with the Google Play Services bump #98, but I'm not sure.

My onMapInitialized:

 @Override
    public void onMapInitialized() {
        map.getMapInterface().setMapToolbarEnabled(false);
        ....
}
 @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        map.setOnCameraChangeListener(this);
        map.setOnMarkerClickListener(this);
        map.setOnMapInitializedListener(this);
        map.initialize(getChildFragmentManager());
    }

Is there anyone else facing this issue?

Thanks!

Zoom levels not documented

As the title suggests, there are methods which take an int zoom level that have no explanation as to hot the argument is supposed to behave.

Marker positions are incorrect in web map when device language is changed

With the sample app installed on a UK based device, Nexus 6 running Lollipop

  1. Change device language to Spanish / German etc
  2. Select 'Use Google Web Map' or 'Use MapBox Map'
  3. RESULT: the markers are incorrectly placed in a horizontal line across globe

If you change the language to certain Asian ones - Chinese, Thai for example, the markers are correctly placed.

Retrieve current location

The map view can be set to track the user's current location, but it is not retrievable. Would it be possible to expose this?

java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.

Hi,
i have tried to create a sample with this code:

import com.airbnb.android.airmapview.AirMapMarker;
import com.airbnb.android.airmapview.AirMapPolyline;
import com.airbnb.android.airmapview.AirMapView;
import com.airbnb.android.airmapview.DefaultAirMapViewBuilder;
import com.airbnb.android.airmapview.listeners.OnMapInitializedListener;
import com.google.android.gms.maps.model.LatLng;

import java.util.Arrays;

public class SelectMapAreaGame extends AppCompatActivity implements OnMapInitializedListener {

    private AirMapView map;
    private DefaultAirMapViewBuilder mapViewBuilder;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_select_map_area_game);

        mapViewBuilder = new DefaultAirMapViewBuilder(this);
        map = (AirMapView) findViewById(R.id.map_view);

        map.setOnMapInitializedListener(this);
        map.initialize(getSupportFragmentManager());

    }

    private void addMarker(String title, LatLng latLng, int id) {
        map.addMarker(new AirMapMarker.Builder()
                .id(id)
                .position(latLng)
                .title(title)
                .iconId(R.drawable.ghost)
                .build());
    }

    @Override public void onMapInitialized() {
        System.out.println("Map onMapInitialized triggered");
        final LatLng airbnbLatLng = new LatLng(37.771883, -122.405224);
        addMarker("Airbnb HQ", airbnbLatLng, 1);
        addMarker("Performance Bikes", new LatLng(37.773975, -122.40205), 2);
        addMarker("REI", new LatLng(37.772127, -122.404411), 3);
        addMarker("Mapbox", new LatLng(37.77572, -122.41354), 4);
        map.animateCenterZoom(airbnbLatLng, 10);

        // Add Polylines
        LatLng[] latLngs = {
                new LatLng(37.77977, -122.38937),
                new LatLng(37.77811, -122.39160),
                new LatLng(37.77787, -122.38864)};

        map.addPolyline(new AirMapPolyline(Arrays.asList(latLngs), 5));


        // Add Circle
        map.drawCircle(new LatLng(37.78443, -122.40805), 1000);

        // enable my location
        map.setMyLocationEnabled(true);
    }
}

and i have a blank view with this in the console:

W/webcore: java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.
                                                                          at android.webkit.WebViewCore$EventHub.removeMessages(WebViewCore.java:1684)
                                                                          at android.webkit.WebViewCore$EventHub.access$7900(WebViewCore.java:927)
                                                                          at android.webkit.WebViewCore.removeMessages(WebViewCore.java:1796)
                                                                          at android.webkit.WebView.sendOurVisibleRect(WebView.java:2953)
                                                                          at android.webkit.ZoomManager.setZoomScale(ZoomManager.java:593)
                                                                          at android.webkit.ZoomManager.access$1700(ZoomManager.java:49)
                                                                          at android.webkit.ZoomManager$PostScale.run(ZoomManager.java:984)
                                                                          at android.os.Handler.handleCallback(Handler.java:605)
                                                                          at android.os.Handler.dispatchMessage(Handler.java:92)
                                                                          at android.os.Looper.loop(Looper.java:137)
                                                                          at android.app.ActivityThread.main(ActivityThread.java:4424)
                                                                          at java.lang.reflect.Method.invokeNative(Native Method)
                                                                          at java.lang.reflect.Method.invoke(Method.java:511)
                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
                                                                          at dalvik.system.NativeStart.main(Native Method)

how i can fix?

Move map without moving marker

Hi all.

I'm using AirMapView and have a question that How to move map without moving a marker (indicate my current location on map). My solution is adding an ImageView that is centerInParent of the map, but when taking the snapshot of the map, it does not have a marker.

Could you all support my question above ?
Thanks

NativeGoogleMapFragment: Setting location enabled and denying permissions leads to inconsistent state

https://github.com/airbnb/AirMapView/blob/master/library/src/main/java/com/airbnb/android/airmapview/NativeGoogleMapFragment.java#L269

Setting location enabled here sets the global variable myLocationEnabled to true but if permissions are rejected the googleMap's location is never enabled. Trying to set the location enabled at a later point calling setMylocationEnabled(true) will no longer do anything unless you disable the location that was never enabled.

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.