How to display streetview in android AVD?
I write map.setStreetView(true); but only display blue outline.
Also here is a site with an example in use (scroll down to step 7):
http://mobile.tutsplus.com/tutorials/android/android-sdk-quick-tip-launching-maps-in-app/
You have to build the string using your long and lat points, and then launch a new ACTION_VIEW intent.
For example:
Intent streetView = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("google.streetview:cbll="+ latitude+","+longitude+"&cbp=1,99.56,,1,-5.27&mz=21"));
startActivity(streetView);
At the bottom:
http://developer.android.com/guide/appendix/g-app-intents.html
http://mapki.com/wiki/Google_Map_Parameters#Street_View
You have to tell it where you want to view:
map.getStreetView().setPosition(latLng:LatLng);
map.getStreetView().setVisible(flag:boolean)
Related
Well, thats the question, I thought that it would be possible to do something like map.setSatellite(true); but is not possible in OSMdroid.
Another trouble is if its possible to download maps, because I need to work offline, and my boss says that it should be possible to download the maps.
The only way I know to use offline maps is making the maps with mobac and then manually store them to consult.
I have read something about using bing, but im not sure, do you know another way to do it?, I guess I will need to be online to work with bing libraries. Am I right?
I know it's too late to post this answer but for others, it will help
OpenStreetMap(OSM) does not offer any aerial imagery layer(satellite view). But using MAPBOX we can achieve satellite view in OSM.
To do this use the following code snippet:
Add this meta data in AndroidManifest
<meta-data
android:name="MAPBOX_MAPID"
android:value="satellite-streets-v11"/>
<meta-data
android:name="MAPBOX_ACCESS_TOKEN"
android:value="PUT_YOUR_MAPBOX_ACCESS_TOKEN"/>
Create MapBoxTileSourceFixed.java class as follow
//waiting for osmdroid #1718 to be fixed:
class MapBoxTileSourceFixed extends MapBoxTileSource {
MapBoxTileSourceFixed(String name, int zoomMinLevel, int zoomMaxLevel, int tileSizePixels) {
super(name, zoomMinLevel, zoomMaxLevel, tileSizePixels, "");
}
#Override public String getTileURLString(final long pMapTileIndex) {
StringBuilder url = new StringBuilder("https://api.mapbox.com/styles/v1/mapbox/");
url.append(getMapBoxMapId());
url.append("/tiles/");
url.append(MapTileIndex.getZoom(pMapTileIndex));
url.append("/");
url.append(MapTileIndex.getX(pMapTileIndex));
url.append("/");
url.append(MapTileIndex.getY(pMapTileIndex));
//url.append("#2x"); //for high-res
url.append("?access_token=").append(getAccessToken());
String res = url.toString();
return res;
}
}
And finally set MapBoxTileSource in mapview as follow
OnlineTileSourceBase MAPBOXSATELLITELABELLED = new MapBoxTileSourceFixed("MapBoxSatelliteLabelled", 1, 19, 256);
((MapBoxTileSource) MAPBOXSATELLITELABELLED).retrieveAccessToken(this);
((MapBoxTileSource) MAPBOXSATELLITELABELLED).retrieveMapBoxMapId(this);
TileSourceFactory.addTileSource(MAPBOXSATELLITELABELLED);
map.setTileSource(MAPBOXSATELLITELABELLED);
map.getOverlayManager().getTilesOverlay().setColorFilter(null);
Output:
see original repository here
Enjoy coding :)
You can use this code for google map satellite view
getMap().setMapType( GoogleMap.MAP_TYPE_SATELLITE );
and you can take refrence from this link also for implementing google map
https://code.tutsplus.com/tutorials/getting-started-with-google-maps-for-android-basics--cms-24635
and for the google map download you can use this reference
https://stackoverflow.com/a/19184812/6869491
I hope it will help you
You can use MapBoxTileSource, with mapbox.streets-satellite as MAPBOX_MAPID.
You will have to request an Access Token on MapBox site.
OnlineTileSourceBase MAPBOXSATELLITELABELLED = new MapBoxTileSource("MapBoxSatelliteLabelled", 1, 19, 256, ".png");
((MapBoxTileSource) MAPBOXSATELLITELABELLED).retrieveAccessToken(this);
((MapBoxTileSource) MAPBOXSATELLITELABELLED).retrieveMapBoxMapId(this);
TileSourceFactory.addTileSource(MAPBOXSATELLITELABELLED);
mapView.setTileSource(MAPBOXSATELLITELABELLED);
And in the manifest:
<meta-data
android:name="MAPBOX_MAPID"
android:value="mapbox.streets-satellite"/>
<meta-data
android:name="MAPBOX_ACCESS_TOKEN"
android:value="... YOUR MAPBOX ACCESS TOKEN HERE ..."/>
I'm trying show all my map makers on Here maps, but I don't want cluster them to a number, like image. I used Here maps app, markers not clustered Here Maps.
What should I do ?.
You can find information about it here.
You can use the ClusterLayer class.
ClusterLayer cl = new ClusterLayer();
If you want to customize the image use their ImageClusterStyle & ClusterTheme.
ImageClusterStyle imageCluster = new ImageClusterStyle(img);
ClusterTheme theme = new ClusterTheme();
theme.setStyleForDensityRange(2, 9, imageCluster);
cl.setTheme(theme);
I have written a program that can create shortcut of my application in android emulator homescreen.But the problem is when i created the shortcut then it has the default android icon.
My question is how can i change the icon of the shortcut ?
I have used the following line to set the icon
Intent j=new Intent();
j.putExtra(Intent.EXTRA_SHORTCUT_INTENT,i);
j.putExtra(Intent.EXTRA_SHORTCUT_NAME,n);
j.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,R.drawable.icon);
j.putExtra ("duplicate", false);
j.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
sendBroadcast(j);
The system is not in your context. You therefore need to give more details to send you icon.
see https://github.com/ldo/ShortcutCircus_Android/blob/master/src/Activity2.java
The icon is given by :
Intent.ShortcutIconResource.fromContext(Activity2.this, R.drawable.icon)
Or you could decode the bitmap and use EXTRA_SHORTCUT_ICON instead.
You can do this in two way.
putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,resId);
putExtra(Intent.EXTRA_SHORTCUT_ICON, bitmap);
Right now, I'm launching the Google Maps application with the following call:
String geoAddress = "maps.google.com/maps?q=";
geoAddress += LatLong[0] + "," + LatLong[1];
Intent i = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(geoAddress));
startActivity(i);
Which will open and place a marker at the specified position on the map. I have two questions:
1) How can I place multiple markers of which I have the Longitude/Latitude?
2) How can I start the Maps application to other modes (terrain/satellite/etc.)?
Thanks!
you can add multiple links on the map by using overlays,and u can see the GoogleMapview example in http://developer.android.com/resources/tutorials/views/hello-mapview.html.
here you can understand use of overlays.
Read the following links and download the code the link(For Further reference)
https://github.com/jgilfelt/android-mapviewballoons
https://github.com/jgilfelt/android-mapviewballoons#readme
2.To change the views use following functions,
mapView.setSatellite(true);
mapView.setStreetView(true);
For further reference
http://mobiforge.com/developing/story/using-google-maps-android
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