Deprecated : This article is no longer maintained.
Special Note : I have received so many queries regarding not running the bing map on 4.0 onward OS version. Bing map uses the WebView to display the map and due to some bug its not showing the map on device. Lets hope Microsoft resolves it ASAP
Hi Folks,
I was just sitting idle in office (No work is assigned in project 😉 ).But as you know a developer should not sit idle. Once should keep exploring. So I just start to know bing map in android (Google is no more enjoying monopoly in map business 😮 ). There are 3-4 different views like Road Map,Ariel,Bird eye view etc. You will love bird eye view.Graphics are nicer than Google map.I tired this example on HTC sensation I feel its bit laggy. Anyways its has a list of pros and cons but lets start step by step integration of Bing map in android device.
First bookmark bing map site for developer.
Step 1:
- Now very first requirement to have a windows live id. If you do not have such id create one . Go to map portal and get yourself registered. And if you are already having id sign in using that credentials.
Step 2 :
- After creating windows live account it will again redirect to one screen where you need to create one account (It’s a formality to identify each map key user.) See below image.
- Now on left hand side menu click on Create or view keys.
- Fill required information.
- Application Name : Test App
- Application URL : Leave the field blank (It’s not compulsory)
- Application type : Mobile
- Feel CAPTCHA and submit the details.
- Scroll down a bit you will be able to see a key generated below.
- Now after this we are done with the registration process.
Step 3 :
- Now download Bing map SDK from here.
- You will have a zip file in your downloading dialog. Extract that zip file after downloading and import that in eclipse workspace.
Step 4 :
- Now what we have to do is to use that key which we have generated few minutes back.
- Now open Constants.java from package org.bingmaps.app
- You will be able to see two variables BingMapsKey and BingSpatialQueryKey replace both variable by values explain below.
- BingMapsKey=”Your map key”
- BingSpatialQueryKey=”Mobile”
Step 5 :
- Clean your build and build again. Deploy it on device. (I was not able to test this on simulator so I am not sure whether it will work on simulator or not.)
- You will be able to see below given screens.
- I will try to extend this thread by explaining few more things like how to display pin or overlay on it etc.
You can download modified source code from here.
HI Hardik,
This is nice article.. I know that you have good knowledge in this..
so keep going and share this kind of knowledge.. okay I like this one..
Thanks Ruchika 🙂
hey Hardik, Nice one….thanks for sharing….Can you guide or provide code how to send and Image from phone’s Gallery to Server??
,your friend Ronak Pandya (LJ)
Hey Ronak, Good to see comments from you. Posting image from gallery is pretty simple. Refer following links :
http://android-er.blogspot.in/2011/02/select-image-using-android-build-in.html
http://stackoverflow.com/questions/4344806/load-an-image-from-the-gallery-in-android
Once u able to fetch the image. You need to send byte[] of images to server using web service. or Call me I ll explain you 🙂
Thanks a lot for your quick reply,I have fetched image from gallery and now i have to send that image to my local server. i dont know how to do it…if possible pls send code or proper example..Thanks. email – rp_167@yahoo.co.in
I would have surely give you a code snippet. But I dnt hv such thing ready with me. But I can guide you.
http://stackoverflow.com/questions/4941580/android-upload-large-image-to-server
On server side make one webservice who takes data from url
And on android side just call that webservice with necessary parameters using HttpPost class.
Thanks a Lot….Will call You…!!!
Hey i cant run it on ma thinkpad tab .help me and how can i integrate this map with another application ?
Ok. Can you tell me what error it gives? Please check that GPS and Internet is available on tab. This is very elementary level of sample project. I have not done all kind of error handling.
I tried integrating the bing map on to the android.But when i am running this app on the device it is only showing the first screen with the earth logo and its not progressing further to the Map.Please help me the same.
Are you able to see zoom-in buttons in mapview ?
No It is stuck in the first page with the earth logo.I cannot see the map itself.
I hope you have configured all your key well. Please once again go step bby step. There will be some minor mistake
Its still the same.Tried all possible ways,but getting struck in the initial page.
Are running an example attached with blog
Or you have created a new user on microsoft’s map portal
I have tried both.But the same output.
Ok Buddy I got the problem, Following things are on our check list
1) Check Map Key : If you are using old map key which was given in demo change it to some other as they kept alive for only 90 days as it was for trial version
2) On which OS you are running the code ? If its 4.0 onwards its giving error in webview. I havent what error it is giving in webview. I checked in 2.3 it works fine.
Hi guys,
Is there any workaround for android 4.0 ?
Hvnt found yet. Bing map is used quiet lesser thn Google’s map. Hvnt spend time to do r&d on that.
Hey How I will get the ‘BingSpatialQueryKey=”Mobile”’ , I am launching this bing map on Tablet. Please Help me. Thank you.
Thing is clear its just to indicate that request for loading map is coming from Mobile platform.
I am not sure about tablet. As I have already addressed many developers that its has some bug in 4.0 onwards platform. You tab must be running ICS. so the problem is due to that I guess.
I am failing to implement the “bing map” on Android Tablet. The same apk of application working well on Android Mobile. Please help
Which OS version your mobile phone and Tablet is running ?
Mobile OS Android 2.2,Here Bing Map working fine.
and Tablet (Micromax Funbook) OS Android 4.0.3 not showing map.
What will be the problem?
As I am mentioning in all previous comments, its having some issue for 4.0 onward versions.
The bugs aren’t with Bing Maps but with WebView.in Android. Otherwise, what worked in previous versions of WebView should work in the latest version.
Agree, either way its a bug. And it should get fixed by either party. Android has modified its webkit now, Microsoft should also update the SDK.
Can not loading bing map after some time unfortunate close the app please help me
Hello Hardik,
You have share a best solution, but when i am trying to access sdk / source code, its showing “No page found”. Can you please help me to get a source code?
Is there any sdk or library for xamarin android for Bing Map?
Here is how you do Google Map in Xamarin https://developer.xamarin.com/guides/xamarin-forms/user-interface/map/ There is new SDK for android now , not sure how much they support for xamarin. Check out https://www.bing.com/api/maps/sdkrelease/mapcontrol/isdk#overview
can you please guide me how to integrate bing map as base layer in an android app and overlay my layers published in geoserver on it.