0

I am trying to made windows phone application with offline routing. I have found that It is possible by using Bing API. I have registered and got the key, but I can't find, how can I use the key.

I am using following code:

    private async void Button_Click(object sender, RoutedEventArgs e)
    {
        RouteQuery query = new RouteQuery();

        List<GeoCoordinate> wayPoints = new List<GeoCoordinate>();

        wayPoints.Add(new GeoCoordinate(47.23449, -121.172447));
        wayPoints.Add(new GeoCoordinate(47.062638, -120.691795));

        query.Waypoints = wayPoints;
        query.QueryCompleted += geoQ_QueryCompleted;
        query.QueryAsync();
    }

    private void geoQ_QueryCompleted(object sender, QueryCompletedEventArgs<Route> e)
    {
        try
        {
            Route myRoute = e.Result;
            MessageBox.Show("Completed");
        }
        catch (TargetInvocationException)
        {
            /// Unauthorized access exception 0x8004231C
            Thread.Sleep(1000); // waiting for  completing the query
            geoQ_QueryCompleted(sender, e);
        }

    }

But I am getting Unauthorized access exception 0x8004231C. I would like to ask you, how can I fix it?

Krivers
  • 1,986
  • 2
  • 22
  • 45
  • possible duplicate of [Bing Maps GetRoute gives '0x8004231C' error](http://stackoverflow.com/questions/23218392/bing-maps-getroute-gives-0x8004231c-error) – Swift Sharp May 04 '15 at 12:13

1 Answers1

1

You don't need the key to show offline map. If you have map downloaded on your device, then offline routing should work. You can see the sample to get more details.

Following is the quote from msdn sample,

However, mapping services also work without Internet connectivity when maps are downloaded for offline use. 
Abhishek
  • 6,912
  • 14
  • 59
  • 85