I want to show a marker on Google Maps API V2:
this is my code:
driverMarker = new MarkerOptions();
driverMarker.icon(BitmapDescriptorFactory.fromResource(R.drawable.driver_car));
driverMarker.position(driverLocation);
driverMarker.title(getDriver().getName());
googleMap.addMarker(driverMarker);
The driver name is saved in Hebrew, and also my Google maps language is in Hebrew (the street names). However, when my getDriver().getName() returns string in Hebrew it doesn't show me the title (the title is blank as you can see in the screenshot attached). But if the poi.getName() returns string in english it show the title on the marker...
What can I do in order to display Hebrew on the marker's title???
screenshot
You can find the solution here by #Gavriel:
Non-ASCII title for android map marker
In short:
You can use android:textDirection="locale" on TextView in customized InfoWindowAdapter (if you are using api 17 and higher)
or
Prepend an unicode left-to-right mark to the title/snippet:
.title("\u200e" + titleText)
.snippet("\u200e" + snippetText)
Related
I am attempting to show the title of a map marker using Here Maps.
According to this SO question, the showInfoBubble() is deprecated. And the link it contains goes 404.
However, the official documentation does not show it as deprecated.
My map will always just show two or less locations. And I wanted to show the info bubble with the title. However, showInfoBubble() isn't a method of the MapMarker class despite being shown as one.
I have searched the official GitHub for examples, however I cannot find anything on showing the title.
Has anyone figured this out? Or can you point me to an example or the correct documentation?
private void addMarkerAtPlace(GeoCoordinate marker, String title, String description, Image icon) {
MapMarker mapMarker = new MapMarker();
mapMarker.setIcon(icon);
mapMarker.setCoordinate(new GeoCoordinate(marker));
mapMarker.setTitle(title);
mapMarker.setDescription(description);
m_map.addMapObject(mapMarker);
m_mapObjectList.add(mapMarker);
//Show Title can only be shown after being added to the map
//however this doesn't work!!!
mapMarker.showInfoBubble();
}
Summary: A comment about the deprecation: You refer to the Starter SDK version 3.x, but the linked SO question was about the Premium SDK. Two different products at the moment. Deprecation seems to be the case only for the Premium edition (where MapOverlays have been introduced, what's also not available in Starter as far as I can see).
See current overview for the SDKs over here: https://developer.here.com/products/here-sdk
I have an intent picker in my app. When the user selects Google Maps, I want to set the title and subtitle in the maps.
How do I get the subtext set in Google Maps?
I looked at the api(https://developer.android.com/guide/components/intents-common.html#Maps) and I used
geo:0,0?q=lat,lng(label)
But I can only set the title text(label) using this. How do I set the subtitle?
I want to do it only using common intent for location and not just Google Maps.
I am adding Bitmap image on Google maps using GroundOverlayOptions, that image will be overlaid on the Google maps.
Below is my code.
#Override
public void onLocationChanged(Location location) {
TextView tvLocation = (TextView) findViewById(R.id.tv_location);
location = generateRandomLoc(location, 0);
double latitude = location.getLatitude();
double longitude = location.getLongitude();
LatLng latLng = new LatLng(latitude, longitude);
//Setting padding to hide google logo
mapView.setPadding(-10,0,0,0);
CameraPosition cameraPosition = new CameraPosition.Builder().target(latLng).build();
mapView.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
mapView.moveCamera(CameraUpdateFactory.newLatLng(latLng));
//get camera position frm map view
LatLng cameraPosLatLng = mapView.getCameraPosition().target;
if (isFlag) {
BitmapDescriptor image = BitmapDescriptorFactory.fromResource(R.drawable.overlay_pink_image);
mapView.addGroundOverlay(new GroundOverlayOptions()
.image(image).position(latLng, 458, 274)
.transparency(0.5f));
mapView.animateCamera(CameraUpdateFactory.zoomTo(17));
}
if (cirle != null) {
cirle.remove();
}
cirle = mapView.addCircle(new CircleOptions().center(cameraPosLatLng).strokeColor(Color.GREEN).fillColor(Color.GREEN).radius(0.7));
}
I am trying to hide Google logo from the MapView by setting padding, but That logo won't be hidden from the MapView. When I set -10 padding at left or bottom that 10% of view will be disabled. But in case of map view, this may be different. If I set padding(50,0,0,0); that logo will be placed at right. How can I disable or hide the logo of Google on Google maps.
Any help would be appreciated.
Try to respect the Google Maps Terms of Service
9.4 Attribution.
Content provided to you through the Service may contain the Brand Features of Google, its strategic partners, or other third-party rights holders of content that Google indexes. When Google provides those Brand Features or other attribution through the Service, you must display such attribution as provided (or as described in the Maps APIs Documentation) and must not delete or alter the attribution.
You must conspicuously display the "powered by Google" attribution (and any other attribution(s) required by Google in the Maps APIs Documentation) on or adjacent to the relevant Service search box and Google search results. If you use the standard Google search control, or the standard Google search control form, this attribution will be included automatically, and you must not modify or obscure this automatically-generated attribution.
Developers don't have the authority to replace the logo even though it's possible.
[UPDATE]
3.2.3 Requirements for Using the Services.
(b) Attribution. Customer will display all attribution that (i) Google provides through the Services (including branding, logos, and copyright and trademark notices); or (ii) is specified in the Maps Service Specific Terms. Customer will not modify, obscure, or delete such attribution.
Simple! I achieved this by doing the following either directly on the fragment or any parent layout.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="-30dp"
android:layout_marginTop="-30dp">
<fragment
android:id="#+id/map_frag_main"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" />
</RelativeLayout>
Adding the layout_margin will clip away the Google logo and no need for padding, just make sure you add a drawable or you will be violating TOS. Cheers!
Hiding Google logo from Google map and Google earth images are against terms of usage of Google Maps. So even though there might be a way to do it, it would be illegal. You can found TOS and related rule below.
https://developers.google.com/maps/terms
9.4 Attribution.
Content provided to you through the Service may contain the Brand Features of Google, its strategic partners, or other third-party rights holders of content that Google indexes. When Google provides those Brand Features or other attribution through the Service, you must display such attribution as provided (or as described in the Maps APIs Documentation) and must not delete or alter the attribution.
You can achieve it in Android using:
final ViewGroup googleLogo = (ViewGroup) findViewById(R.id.single_map).findViewWithTag(Const.GOOGLE_MAPS_WATERMARK).getParent();
googleLogo.setVisibility(View.GONE);
Where single_map is the instance of SupportMapFragment.
You may remove it through xml or programatically but simple official answer to it is.
You can’t, because it is not legal
This CSS will remove Google Logo, terms of use, and Report a problem div.
a[href^="http://maps.google.com/maps"]{display:none !important}
a[href^="https://maps.google.com/maps"]{display:none !important}
.gmnoprint a, .gmnoprint span, .gm-style-cc {
display:none;
}
.gmnoprint div {
background:none !important;
}
I'm developing an android project,in this project i have google map view and i use google map v2 . The problem is, i have some MarkerOption and i'm setting a utf8 string for them but the titles are shown as an empty string
here is my code for adding markers:
MarkerOptions marker = new MarkerOptions().position(pos).title("سلام");
marker.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
googleMap.addMarker(marker);
how can i solve this?
thanks for any helps
you must set an English word then set your string :
MarkerOptions marker = new MarkerOptions().position(pos).title("TEST:"+"سلام");
You can add a unicode left-to-right mark ("\u200e") to your text, like:
.title("\u200e" + "سلام");
I have my own offline map data in my app but only for a small region. Now I'd like to overlay this data onto my Google Map V2. This also already works. The only thing missing now is that GoogleMaps still overlays it's road names / city names above my tiles.
Is it possible to display a google map V2 in Android with MAP_TYPE_NORMAL and overlay custom tiles above roads?
TileOverlay overlay = map.addTileOverlay(new
TileOverlayOptions().tileProvider(provider).zIndex(2000));
The zIndex does't seem to help me here.
I think there is no way to display your tile-layer over the road names/city names.
How about display your offline map as Marker?
It should be displayed on the top.
try this link for https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/TileOverlay &
EXAMPLE :
GoogleMap map; // ... get a map.
TileProvider tileProvider; // ... create a tile provider.
TileOverlay tileOverlay = map.addTileOverlay(
new TileOverlayOptions().tileProvider(tileProvider));
Hope this helps.
As far as I know, you cannot place TileOverlays or GroundOverlays on top of labels. Your best option might be to use a different map type. This can be changed after the map has been created (i.e. in the onMapReady method by using the mMap.setMapType(...) method). Here are some possibilities:
MAP_TYPE_NORMAL + Custom Map Style
You can easily create your own map styles by using the Styling Wizard. It allows you to create a style that excludes labels entirely (among other things). Once you've created a style you like, you can copy the JSON code generated by that website and add it to the project file res/raw/style_json.json. The style can then be applied like this:
mMap.setMapType( GoogleMap.MAP_TYPE_NORMAL );
try
{
boolean success = mMap.setMapStyle(
MapStyleOptions.loadRawResourceStyle(
getContext(), R.raw.style_json ) );
if( !success )
{
Log.e( TAG, "Style parsing failed." );
}
}
catch( Resources.NotFoundException e )
{
Log.e( TAG, "Can't find style. Error: ", e );
}
MAP_TYPE_NONE + Custom Map Tiles
If you need to have labels outside of your TileOverlay, you could add a second TileOverlay of non-Google map tiles (like those provided by OpenStreetMap). These typically include the labels within the map tiles themselves. So if your TileOverlay is added with a higher z-index, it will appear on top of these other map tiles!
Map Types Without Labels
MAP_TYPE_SATELLITE and MAP_TYPE_NONE don't include labels. If you don't need any map data outside of your TileOverlay, using MAP_TYPE_NONE will save on mobile data.