Incorporation of Google Maps - android

I want to incorporate a google map in my online grocery system in my android application in java. Which activity should I use to incorporate it. I am just starting my project to build. I am confused that from which activity should I start?
I have make an app which uses google map separately through google map activity. But this time, I want to add it in a huge project. Can I use main activity for incorporating google maps?

Firstly, you should make single activity apps and display different fragments in your app. For example, you might have a login fragment and a groceries fragment (that displays all groceries or/and groceries filters), etc. You should put your Google map MapView in a fragment or use a premade Google maps fragment.
Remember MapView has its lifecycle that you will have to override. Other than that using MapView is pretty straightforward.
But if you insist on using activities you can use the MapActivity class, which is a subclass of Activity. This class provides a framework for displaying a map, and you can customize the appearance and behavior of the map using the MapView class.
You also need to implement the OnMapReadyCallback interface and override the onMapReady() method to set up the map and add any markers or other features to it.
I would recommend reading the documentation and watching a few videos on the topic.
MAPS DOCUMENTATION:
https://developers.google.com/maps/documentation/android-sdk/start

Related

MKMapView heading features in Android with Google Maps APIs?

How can I implement MKMapView heading features in Android with Google Maps APIs?
Screenshot: iOS MKMapView with heading example
I would use sensors to the orientation of the map and display the map as if you were a navigation mode.
Try using MapView which is just one of the several Map Objects.
A View which displays a map (with data obtained from the Google Maps
service). When focused, it will capture keypresses and touch gestures
to move the map.
Users of this class must forward all the life cycle methods from the
Activity or Fragment containing this view to the corresponding ones in
this class.
For actual codes checkout the Google maps android samples in Github.

User navigation on google maps - how to?

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!

Display a custom map in a MapFragment

Recently, Google Maps Android API v2 has been released, introducing MapFragment. It seems like a neat feature. However, I was wondering if it would be possible to use a MapView with the MapFragment to display a custom map instead of having a map loaded by the Google Play Services.
Looking at the documentation for MapFragment, I couldn't find any methods that would allow to attach a custom MapView. Moreover, it seems like you can never replace the GoogleMap that is used in the MapFragment.
For me this seems like, in order to be able to use custom maps, you cannot use the new maps API. I would appreciate the input of more knowledgeable people on this matter.
Edit: I would appreciate if someone could add the android-mapfragment tag, thereby creating it. Feel free to remove this edit once you have done so.

Android: How to implement pre-cached functionality with google map in my app?

In my application i need to implement pre-cached functionality like native Google map application in android phone.I have map in my application already when i navigate from one point to another point it starts loading the map i want in my application i could store map if a particular city not whole world because it would be too big.
You cannot do this with Native MapView (Terms of Service). Take a look at OSM !

Android Google maps api vs JavaScript Google maps api

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.

Categories

Resources