Have you ever used Google Static Map API? Let me introduce static-map android library based on this great service.
This is open source software, so you are welcome to get source code at github project page. Also, feel free to create issues regarding bugs of improvement suggestions. I can't promise I'll resolve them asap, but I'll try to find time for that =)
Google Static Map API documentation is available here. Please, read it first if you are not familiar with service requirements and differences. Also, you can find usage limits and support there.
Supported features:
This is open source software, so you are welcome to get source code at github project page. Also, feel free to create issues regarding bugs of improvement suggestions. I can't promise I'll resolve them asap, but I'll try to find time for that =)
Google Static Maps service
Google Static Map API documentation is available here. Please, read it first if you are not familiar with service requirements and differences. Also, you can find usage limits and support there.
Supported features:
- Basic map params: zoom, scale, image size
- Secure access (https protocol support)
- Location setting (geo position, address)
- Map types (roads, satellite, etc)
- Markers (without custom icon)
Unfortunately, a lot of Google Static Maps service features are not supported by library yet. Such as paths, maps styles, image formats, viewports, etc. Well, these features may be implemented in next versions of library. But you are always welcome to fork project at github and implement you own needs. If so, please, make pull request and help this little project to grow.
The library available at maven central repository. You can use Gradle,please resource to generate dependency definition. Or just type:
There are javadoc and sources packages available to download from maven repo. Please, read more about dependencies classifiers at gradle userguide page.
Use Config class to set map generation basic params. Example:
StaticMap class contais two static methods for map generation. To get map image synchronously use like this:
The StaticMapException instance will be thrown as wrapper of other occurred exception such as IOException or MalformedURLException.
To get map image asynchronously, use another method with Callback param:
This method encapsulates AsyncTask class to load image in background.
Note: Callback class methods will be invoked in main thread.
The library support API level 15+. I made this decision considering this post. And I hope this will help to decrease number of preICS devices =)
Have a good coding!
Google made its own lite mode of google maps in play services v6.5. So, this library will not be supported anymore.
Usage
The library available at maven central repository. You can use Gradle,please resource to generate dependency definition. Or just type:
dependencies { compile 'com.github.d-max:static-map:0.1.3@aar' }
There are javadoc and sources packages available to download from maven repo. Please, read more about dependencies classifiers at gradle userguide page.
Use Config class to set map generation basic params. Example:
Config config = new Config(); config.setImageSize(200, 300) .setZoom(10) .setAddress("Kyiv");
StaticMap class contais two static methods for map generation. To get map image synchronously use like this:
Bitmap img; try { img = StaticMap.requestMapImage(context, config); } catch (StaticMapException ex) { /* log exception message */ }
The StaticMapException instance will be thrown as wrapper of other occurred exception such as IOException or MalformedURLException.
To get map image asynchronously, use another method with Callback param:
Bitmap mapImage; Callback callback = new Callback() { public void onFailed(int code, String msg) { /* handle error */ } public void onMapGenerated(Bitmap bitmap) { mapImage = bitmap; } }; StaticMap.requestMapImage(context, config, callback);
This method encapsulates AsyncTask class to load image in background.
Note: Callback class methods will be invoked in main thread.
The library support API level 15+. I made this decision considering this post. And I hope this will help to decrease number of preICS devices =)
Have a good coding!
UPDATE (29-12-2014)
Google made its own lite mode of google maps in play services v6.5. So, this library will not be supported anymore.
Awesome article. It is so detailed and well formatted that i enjoyed reading it as well as get some new information too.
ReplyDeleteangularjs Training in chennai
angularjs Training in chennai
angularjs-Training in tambaram
angularjs-Training in sholinganallur
angularjs-Training in velachery
I always enjoy reading quality articles by an individual who is obviously knowledgeable on their chosen subject. Ill be watching this post with much interest. Keep up the great work, I will be back
ReplyDeletepython training in pune | python training institute in chennai | python training in Bangalore
Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.
ReplyDeleterpa training in velachery| rpa training in tambaram |rpa training in sholinganallur | rpa training in annanagar| rpa training in kalyannagar
Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.
ReplyDeleteData Science Training in Indira nagar | Data Science Training in Electronic city
Python Training in Kalyan nagar | Data Science training in Indira nagar
Data Science Training in Marathahalli | Data Science Training in BTM Layout
I simply couldn't leave your site just my reading this blog. I am really impressed with the content and way of writing. Keep sharing more.
ReplyDeleteBest English Speaking Course in Mumbai
English Classes in Mumbai
Best Spoken English Classes in Mumbai
English Speaking Training Center in Mumbai
Spoken English Coaching Institute in Mumbai
Best English Classes in Mumbai
Best English Speaking Training near me
I know you feel more happy when you get things done and best of all those things are your most precious treasure.
ReplyDeleteMicrosoft Azure online training
Selenium online training
Java online training
Python online training
uipath online training
Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging.
ReplyDeleteJava training in Chennai
Java Online training in Chennai
Java Course in Chennai
Best JAVA Training Institutes in Chennai
Java training in Bangalore
Java training in Hyderabad
Java Training in Coimbatore
Java Training
Java Online Training
Extraordinary Blog. Provides necessary information.
ReplyDeletebest digital marketing course in chennai
best digital marketing training in chennai
ReplyDeleteMindblowing blog very useful thanks
SEO Training in T Nagara
SEO Training in Chennai