I am confused between webview and mapview, which is better?? in terms of flexibility, overlays, usage, load-speed, zoom levels etc etc
MapView is the native built-in class for doing Map related stuff. WebView is a native element for the browser. It has a javascript to Java bridge, so you can call Java methods in your native Android application from the JavaScript page.
For my personal experience:
WebView is less flexible, kinda sluggish for UI interaction.
MapView has better optimizations and has richer content.
MapView has definitely better caching.
MapView loads faster (imo)
The MapView api's make life much easier. Zooming/handling etc is great.
Though if you are good at JavaScript and the V3 you should go for WebView. It all boils down to the feature set (WebView has a larger feature set, or so I've heard) that you want to use, your project duration (MapView is faster and easier to code for)
Those 2 classes are completely different.
The WebView class is there to show a webpage, the MapView class is there to intergrate Google Maps into your application. So depending on what you want to achieve you can pick one.
Since your tags say Google and Maps you should use the MapView, see also the Google Map View tutorial on the Android Developers site.
--
for future questions please provide some more information in your question.
Related
I am trying to compare native google maps (v2) vs the embeddable HTML version encapsulated in a webview on android. While it's pretty evident that the native maps are smoother and faster, I must prove that somehow. I have been searching on the internet for quite some time and did not seem to find any existing benchmarks. Does anybody know someone who actually done something similar? I am already thinking of creating such benchmark of my own, but how can the performance actually be measured? My ideas so far are:
Measure rendering of different number of markers, polylines, etc...
Measure map tile loading (maybe not possible at all)
Somehow measure the lag when dragging the map. This must be somehow based on the map events, but the native GoogleMap class does not seem to have something like onDragListener.
If you have any ideas or know some existing resource, please help me!
-----------------EDITED 03.01.2014----------------
I already started creating my benchmark but now I am struggling with some strange issues - see this question for more details.
The source code of the first version of my benchmark can be found here. It currently does not include automated testing. Nevertheless when experimenting with adding different number of markers and lines you can get an idea of how slower html maps are. I have also uploaded a simple demo on youtube, to view it click here
So Your topic is pretty interesting, but remember if you are going for google maps on mobile vs web, there is mobile v2 and javascript v3. Javascript google maps has some added functionalities that mobile does not offer, you can refer the docs to find out. AND You can perform on various parameters like.
1. Time it takes to load (display) the map on the screen.
2. As you mentioned rendering on the map.
3. Performance issues on low bandwidth.
4. UI and UX.
5. Reliability
6. User Satisfaction
7. Implementation (Complete off topic but since you are doing a thesis I will recommend that)
8. Features
9. At last pricing. (I think upto 20000 calls per day is free on one API key on javascript v3)
NOTE
Anyone feel free to edit and add some more parameters for benchmarking.
I've been unable to find an example how to limit scrolling of android Google maps to defined coordinates or preferably not outside a ground overlay.
There are some examples of extending MapView and overriding the onScroll method, but the MapViewActivity which MapView needs, seems to be deprecated.
I am currently using GoogleMap class with SupportMapFragment, which seems not to support such a thing.
there is this question with an answer which is a bad hack and I rather not use it.
So is it possible?
Not possible without bad hacks as of 3.1.36. You may want to post a feature request on gmaps-api-issues if nobody requested that already.
I am currently working on a school project and I am trying to learn the techniques on downloading OSM map tiles into the phone's local memory/cache, so that users are able to view the maps when offline.
This is to be done by giving a specific location, and the map tiles that are within specific radius/distance from the location will be downloaded into the phone memory (when there is online connection) for offline display.
However, I am having some slight trouble in understanding OSMDroid's APIs. From my understanding, it seems that the classes involved are:
MapTileBase
MapDownloader
IFilesystemCache
Please do correct me if I'm mistaken.
Also, in MapTileBase (which I believe is the provider), the getMapTile returns android.graphics.drawable.Drawable.
Is this Drawable class even related to the concept of offline map display?
Hope someone can enlighten me on where exactly maps are being called to be downloaded into the phone's memory, and how we can edit the maps to display interface items such as routes, pins, etc.
I don't have an exactly answer as you're looking for a method to cache offline outside of an area the MapView hasn't already navigated to. The built in caching support is there, but not exactly how you want to do it.
You're going to need online download capabilities if you plan to cache and not just supply your own offline map tiles. I would take a look at the MapTileDownloader and maybe try to implement your own version of it. The MapTileDownloader.TileLoader.loadTile() method takes a MapTileRequestState which I believe the MapTileProviderArray calls when a map tile is needed.
If you can replicate the existing MapTileDownloader's TileLoader functionality, you can probably inject your own relative MapTileRequestState or straight up MapTile's to the one requested. e.g. Take the TileLoader called MapTileRequestState, inspect it, figure out how to construct new MapTileRequestState/MapTile representing tiles outside the current view. It won't be easy though as you'll have to deal with the different zoom levels, and depending on the zoom level, the radius should be smaller, etc... A lower zoom level of 18 would have a larger tile radius than a higher 10.
Personally I was recently working on trying to work 100% offline so I don't have any example code to help. Good luck even though its been a couple of months.
First, go right the source
https://github.com/osmdroid/osmdroid
There's a few wiki articles that will help, especially the offline map tiles article. In short, use MOBAC or the tool osmdroid provides. OSMBonuspack also has a tool to perform the same task on device.
Map tiles are actually downloaded using this class
https://github.com/osmdroid/osmdroid/blob/master/osmdroid-android/src/main/java/org/osmdroid/tileprovider/modules/MapTileDownloader.java
What would be the advantages/disadvantages of including Google maps in an android app, using the actual Android Google maps api as opposed to using the JavaScript Google maps api inside a WebView ?
MapView inside Activty: I think this is the best option, considering all of the classes you have access to (ItemizedOverlay,Overlay,OverlayItem). It provides a great framework to use with MapActivity. If you're using a full screen map, or a large map, or are doing things with more than 10 or so waypoints, I would use a mapview.
Javascript MapView - I would use this for a smaller-sized map (quarter screen) or anything with one or two waypoints. Keep in mind this is a lighter-weight wrapper over MapView, so heavy processing for multiple overlays may take longer, because you'll have to re-execute your JS code and refresh the WebView.
Overall, IMHO, I would use a MapView inside of a MapActivity because it provides a beefier interface, as well as access to some of the better classes.
Good luck!
There is a realated thread here
the aim of this one is to found which one correspond best to my needs for my next app.
I have started to analyse some of the basic features of javascript v3 and android v2.
I have a com.google.android.maps.MapView in my application. When using the normal view I do not get any data in Jerusalem and its surroundings. When scrolling to the same location with the Maps app or the maps.google.com webpage the place is rich with mapdata.
Is there a (known) difference between the Map API view and the Google view of mapdata that I am unaware of?
The Google APIs Add-On for Android is a proprietary product. As such, there is no real public documentation on what data is provided by the various layers (e.g., satellite), just that the layers exist. Moreover, there is no real configuration for what gets displayed on the various layers -- all you can do is toggle the layers on and off and control gross aspects like zoom levels.