I'm currently doing functional testing with my Android application using Espresso, its awesome. The issue is that I'd like to be able to test specific actions on the Map. As this whole app is centered around interactions with the map, is there any way to actually do it?
Things that would be great to do:
Click on map at certain latLng
Get the specific zoom level, etc.
Anything else that I can do with a map.
I was originally thinking I could call onView(withId(R.id.map))) to get an instance of the map, but that returns a view interactions which I don't believe helps. I'm willing to use other frameworks but if it can be done in espresso, that would be nice.
Related
I spent several hours looking for simple solution and still haven't found one.
MapBox style editor uses this simple feature. That you can hover and click over map, and it shows small popup stating all terrain classes you enabled in your map.
Question, how to do it in Android version of MapBox given I have installed my style. Now I want click on any place in the map and get the same popup stating, for example, that this is building, woods, background here. Or other place would satte, that this is major road.
This IS doable as MapBox studio itself shows. i can't believe it uses some API not available for anyone, as this is one API no map provider gives, while still able correctly draw terrain. What so complex to add this API?
And NO I am not interested in address. I am interested exactly on terrain, for simple task - distinguiosh water from non-water, road from non-road, building, from non-building, don't care where it is by address, so reverse geolocation does not work. Or simpler - I need SIMPLER geolocation, than address.
Your questions kind of confusing but I'll try and help. If I'm reading correctly, you are trying to create an Android app that uses an API similar to Mapbox Studio that allows the user to select/distinguish the difference between objects on the map such as buildings, water, forest, etc.
If this is the case, then first you must understand that Mapbox Studio is using OpenStreetMap data to distinguish between objects. These objects are stored in a database with tags. It's tough to explain so i'll just leave a brief reading wiki page that might help.
To my knowledge, there isn't any API's specific to Android that will give you the kind of information you're looking for. However, if I was in your dilemma I'd take a look at the Overpass API as it's a complex query tool that allows you to send coordinates to it and it will return all the tags (such as building or water) at that location within a JSON object. From there you can parse and use the data in your app. It is very powerful so I suggest reading up on how to use it and test using a website called Overpass Turbo, that's if you decide to use it.
Nevertheless, I hope this helps and I understood your question correctly.
I'm writing an app which allows the user to change the colour of countries on the world map by tapping on them. At the moment I'm struggling to find the apt way to store and display the map, allowing it to be partly coloured at the same time.
On of the solutions I had in mind was to use an SVG and a third-party library, but as far as I know none of them provides the necessary callback to modify the image once it's drawn.
I am merely at the beginning of understanding of what Canvas is, but even now it is clear to me that drawing such a complex object as a world map on Canvas is way too hard. It will probably take ages to load as well.
I have not implemented any of the mentioned things yet. I assume there is a better way that most developers use, so I'd like to find out what it is.
After more than a year I have finally found a working solution.
Google Map's Android API Utils provide a great means of applying various overlays to Google Map views and fragments as well as changing their individual components.
I went with a geojson layer upon the map and updated the fill colour of certain features.
I'm an averagely experienced Android programmer.
I'm currently working on an app that includes the google maps API and among the activities there are two views that include a map fragment. Now I want someone to be able to navigate on one of those views, called mapActivtiy. It basicly consists of a map, that's all. After choosing a location in another view, I want the map to display the direction from the users position (which I already know) and the target's location.
Now, in iOS I'd just throw in the MKDirections stuff from the MapKit framework, but I seem to be unable to find something equivalent for android. Is there any API or something for wayfinding and navigation on the map? If so, where to look for it?
Just to clearify this: I know I can call the google navigation app from my app, but I don't (really) want to do that, I'd prefer staying within my context. Using the navigation app is more of a last resort.
Does anyone have a smart adivce for me?
Any idea would be much appreciated!
So, my question is somewhat of an odd request I think. I was an intermediate java programmer making android apps a couple years ago, but I quit for other things. Now I'm back with a new and (I think) somewhat bold idea and I need help.
I'm wanting to know if it is possible to utilize the google maps api to act as a base for another map that I layer over the top. Think of it as I'm changing the way the map looks and that's about it.
I'm wanting to create a mobile app that has a map with a new/different look than what the base and satellite views have for a set small area of the city. Think of it as something like taking any old image and slapping it over the top of the google map and still being able to navigate with it (obviously if it was a random picture you wouldn't be able to see where it was taking you, but in theory you could essentially create a new map).
Is this possible in both java and obj c?
As far ask I know, you can't add your own tile layer to the Google Maps API for Android. However, you can use osmdroid and add your own tiles. You could also use mapsforge for Android. It comes with it's own tool for creating custom map tiles.
I want to bound google map in android around the UK,so the user can't pan the map to go outside uk.
There is definitely a way (or several ways) to do this for the maps web api (see links: http://econym.org.uk/gmap/range.htm and http://econym.org.uk/gmap/epoly.htm). However, I don't know of a built-in way to do this on android, so it may take some hackery.
You will likely have to rewrite part of the mapview class... I'd try either overwriting the getMaxZoomLevel (as suggested in the first link - simpler but may not work) or trying to somehow intercept all the map movement requests and checking them to see if they fall outside of certain coordinates (harder/may not even be possible - probably have to do something like call getLongituteSpan every time the map moves and maybe try moving the map back if the span is outside your desired area?)