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
Related
I am successfully showing a spherical image using the Google Panorama API
I am using the same code as most tutorials do:
#Override
public void onConnected(Bundle bundle){
Panorama.PanoramaApi.loadPanoramaInfo(GOOGLE_CLIENT,Uri.parse(url)).setResultCallback(
new ResultCallback<PanoramaApi.PanoramaResult>(){
#Override
public void onResult(PanoramaApi.PanoramaResult result){
if (result.getStatus().isSuccess()){
Intent intent = result.getViewerIntent();
if (intent != null){
startActivity(intent);
}
}
}
});
}
Actually, I do not only have one sphere but around 5. I would like to be able to switch between the images clicking on menu items overlayed over the images.
Since the actual activity showing the sphere is not defined by me but started through an intent received in the success callback I have no idea how I can achieve this and the API does not seem to offer much more possibilities.
I guess I can not even show a dialog on top of the sphere.
Does anybody have any ideas for me? I'd appreciate it a lot
Note: This question purposely is phrased very similarly to this SO post.
Solution: Switch to the more recent Google API – Google VR – with which it is possible to embed spherical 360° images in a view instead of starting an activity through an intent, which one has no control of.
Note: The API is still labeled experimental but being part of the VR API this looks like the library being actively developed.
Another advantage: This is open source while the older Google Panorama API is part of google play services, which is not.
PS: Before I looked into these libraries I tested PanoramaGL and OpenPanodroid. Both libraries are not maintained for years and it was no big suprise the results could not keep up with the Google libraries.
In the HERE SDK user guide there is a screenshot showing the next maneuver. See:
https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics/map-guidance.html
Is this something that is provided by the SDK or is the developer expected to render this manually?
Here is the navigation code I am using:
Route route = list.get(0).getRoute();
map.setMapScheme(Map.Scheme.CARNAV_DAY);
map.getPositionIndicator().setVisible(true);
map.setTilt(45);
map.addMapObject(new MapRoute(route));
manager.setRoute(route);
manager.setTrafficAvoidanceMode(NavigationManager.TrafficAvoidanceMode.DYNAMIC);
manager.setRealisticViewMode(NavigationManager.RealisticViewMode.DAY);
manager.setMap(map);
NavigationManager.Error simError = manager.startNavigation(route);
if(simError != NavigationManager.Error.NONE) {
Log.e(LOG_TAG, "Error" + simError);
}
Maybe a bit late, but for the others who are having the same question,
You can use the HERE Mobile SDK UI Kit (MSDKUI) which provides a highly customizable user interface components that can be used on top of the HERE SDKs.
Here is the repo on Github:
https://github.com/heremaps/msdkui-android
Some things are rendered automatically by the HERE SDK, mainly things that are directly tied to the map rendering (like navigation arrows on the street when doing guidance), but most UI things you have to do on your own since most users want to have their own look&feel and UI.
So, yes the maneuver icons are something you have to provide and render in your UI manually (or the other way around: you have the full freedom to decide how it should look like).
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 trying to use the method zoomToSpan() from the Google MapView, but as I have read, this only works, if the MapView is fully loaded, so I want to know if there is a possibility to add a Listener to my Mapview to get a message, when it is done.
I use addListener to place an infowindow on my maps after the map loads, so that that the map will reposition and display the entire infowindow. I do this on a standard web browser, and I am not sure that it applies to the Android platform:
google.maps.event.addListener(map, 'tilesloaded', function(event) {
infowindow.open(map, marker);
// only do this the first time tiles are loaded
google.maps.event.clearListeners(map, 'tilesloaded');
});
Here's my response to another question where you can see more of the code: How to Display Multiple Google Maps per page with API V3
I'm making an app on android, using webview to load google map (using this url for my webview: http://gmaps-samples.googlecode.com/svn/trunk/articles-android-webmap/simple-android-map.html).
but i can't put a marker on that webview, can't somebody tell me how?
http://maps.google.com/maps?saddr=37.423156,-122.084917
The above simply shows the directions screen with missing destination field. If you want the pin to show on a simple map screen do this instead:
http://www.google.com/maps?q=37.423156,-122.084917
Clearly lots of ways to skin a cat - but I am loving the Google Static Maps API.
It generates a standard image (of desired size) and you can add points/lines/polygons all from a URL.
Whilst I haven't checked the terms, it is clearly possible to cache/store the result.
Documentation: http://code.google.com/apis/maps/documentation/staticmaps/
Example: http://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=14&size=512x512&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Ccolor:red%7Clabel:C%7C40.718217,-73.998284&sensor=false
http://maps.google.com/maps?saddr=NJ
load URL like this pass address where you want to put the pin