none
Resuming app after some hours brings MapRouteFinder to fail, cause by "Invalid Credential" RRS feed

  • Question

  • Hi, i'm experiencing a strange behaviour with the map services

    MapRouteFinder.GetDrivingRouteAsync method works pretty fine until i suspend my app for some hours.

    When I resume it, routes stop returning and the MapRouteFinderResult status is showed as "Invalid Credential"

    Refresh MapServices.ServiceToken not solve the issue.

    There is a timeout o something to consider?

    Thank you

    Thursday, June 7, 2018 8:10 AM

Answers

  • Bing maps sessions will timeout after some time. The timeout depends on the type of key you're using. Enterprise keys have a 48 hour timeout while basic keys have a 1 hour timeout. Once this timeout expires you will need to re-set your key to start a new session which will also incur an additional billable transaction.
    • Marked as answer by FlavioMei Friday, July 13, 2018 8:16 PM
    Friday, July 13, 2018 6:38 PM
    Moderator

All replies

  • Hi Flavio,

    By "Refresh" what do you mean?  I don't know for sure but from your description the credentials are timing out.  If you tear down the map and re-register the credentials as if the app was being restarted, does the invalid credentials issue still occur?

    Sincerely,

    IoTGirl

    Thursday, June 7, 2018 10:17 PM
    Owner
  • Hi IoTGirl,
    if i kill and launch again the app, all works fine again.
    Instead if i change page and then I navigate again in the map page, invalid credentials issue persists

    So there is a timeout for these credentials, but i can't find nothing about it in Bing Map documentation

    With 'Refresh' i just means that I tried to set again the token on app resuming, like this:

    public App() 
    {            
        Suspending += OnSuspending;
        Resuming += OnResuming;         
    }
    
    private static void OnResuming(object sender, object e)
    {
        MapService.ServiceToken = "1234-abcd-56789-etc";        
    }

    • Edited by FlavioMei Friday, June 8, 2018 8:22 AM
    Friday, June 8, 2018 7:28 AM
  • Hi Flavio,

    Would you please confirm that you are utilizing your full Bing Maps key? Note that a session ID (session key) can only be used for that particular session, and should not be reused after the app has been resumed.

    Thanks

    Monday, June 11, 2018 7:03 PM
    Moderator
  • Hi Kelvin, yes i'm using the full Bing Maps key in this scenario
    Tuesday, June 12, 2018 1:56 PM
  • Hi Flavio,

    If you could try to reproduce the same scenario again, but this time saving a WireShark so that you can see the communications to and from the service.

    Thanks
    Tuesday, June 12, 2018 6:16 PM
    Moderator
  • Hi  Flavio,

    Same issue here,

    VS 2017 15.7.5 /UWP/C#

    it happend  in a Windows 10 machine, but

    in a windows 10 Mobile work fine.

    Do you have some answer to this ?

    Friday, July 13, 2018 2:01 AM
  • Hi Francisco,

    There seems to be a session timeout.  For your specific scenario, Windows Phone likely has a background task running keeping the session alive while the Windows 10 PC has timed out.  It is recommended that you trap for this condition and re-instantiate the map to make a new session.

    Please follow the steps given by Kevin above if this does not solve your issue.

    Sincerely,

    IoTGirl

    Friday, July 13, 2018 3:53 PM
    Owner
  • Bing maps sessions will timeout after some time. The timeout depends on the type of key you're using. Enterprise keys have a 48 hour timeout while basic keys have a 1 hour timeout. Once this timeout expires you will need to re-set your key to start a new session which will also incur an additional billable transaction.
    • Marked as answer by FlavioMei Friday, July 13, 2018 8:16 PM
    Friday, July 13, 2018 6:38 PM
    Moderator
  • Thank you Duncan that's the answer that i was looking for!
    Friday, July 13, 2018 8:16 PM
  • Hi all,

    I understood that the Basic Key allowed up to 50,000 billable transactions in a 24-hour period ?

    Saturday, July 14, 2018 12:47 PM
  • Thanks, IoTGirl

    My app is just one map page,

    I try,

    if (App.finderResult.Status == MapRouteFinderStatus.InvalidCredentials)

    {Frame.Navigate(typeof(MapPage));

    MyMap.MapServiceToken = "xxxxxxxxxdiIa-xxxxxx";

    }

    But does not work
    Saturday, July 14, 2018 3:48 PM
  • Hi Francisco,

    Based on Duncan's answer, your session token can't be reused.  You will need to reload the map with the full credential key.

    Sincerely,

    IoTGirl

    Saturday, July 14, 2018 9:18 PM
    Owner
  • Make sure that the Application type you are using is set to one of the UWP key types

    Keys with application types marked as "public website" or "dev/test" will not work with the UWP map control or windows services.

    On the Developer center, when you create the key, it should be one of the two UWP types like this:

    Wednesday, July 18, 2018 4:06 PM
    Moderator
  • Hi Duncan.

    Thanks for your time,

    I try with,

    <small>Key type: </small>Basic / Public Windows App (UWP, 8.x, and earlier)
    <small>Created date: </small>07/19/2018.

    And after one hour aprox.

    routes stop returning and the MapRouteFinderResult status is showed as "Invalid Credential"

    Att,

    Francisco.

    Thursday, July 19, 2018 10:08 PM
  • That's expected. Basic keys will time out after one hour and will need to be re-set to start a new session. Try setting your application key directly on the services namespace - Windows.Services.Maps.ServiceToken
    Friday, July 20, 2018 12:06 AM
    Moderator
  • Hi Duncan, 

    Which is the difference between Private Windows App and Public Windows App?

    Thanks in advance, Daniele

    Friday, March 8, 2019 8:12 AM
  • Hi Daniele,

    Please take a look at our licensing page as it has all levels explained there. https://www.microsoft.com/en-us/maps/licensing/options

    Note: You can get to most information about Bing Maps by starting at https://www.microsoft.com/maps/

    Sincerely,

    IoTGirl

    Friday, March 8, 2019 4:52 PM
    Owner