How to integrate Bing map in android

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.
  1. Application Name : Test App
  2. Application URL : Leave the field blank (It’s not compulsory)
  3. Application type : Mobile
  4. 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.
  1. BingMapsKey=”Your map key”
  2. 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.
Map View
Open Menu, tap on get direction enter two endpoints and get your map view displayed path over it.
  • 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.

32 thoughts on “How to integrate Bing map in android

  1. 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..

  2. 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)

      1. 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

    1. 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.

  3. 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.

        1. I hope you have configured all your key well. Please once again go step bby step. There will be some minor mistake

            1. 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.

    1. Hvnt found yet. Bing map is used quiet lesser thn Google’s map. Hvnt spend time to do r&d on that.

  4. Hey How I will get the ‘BingSpatialQueryKey=”Mobile”’ , I am launching this bing map on Tablet. Please Help me. Thank you.

    1. 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.

  5. I am failing to implement the “bing map” on Android Tablet. The same apk of application working well on Android Mobile. Please help

      1. 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?

        1. As I am mentioning in all previous comments, its having some issue for 4.0 onward versions.

  6. 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.

    1. 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.

  7. 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?

  8. 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.

Leave a comment