Search code examples
javascriptwindows-runtimewindows-store-appswindows-phone-8.1bing-maps

Bing Speech and Bing Maps conflicting in Windows 8 Store app


Bing maps dosent work when bing speech is also referenced in a win8 system(works for win8.1 system). In veapicore.js and veapiModules.js there is window[$MapsNamespace]. When both spech and maps are referenced maps is never intialized in the namespace. Only speech is present which.The maps namespace has only 2 dll files which is refernced by bing speech. This happens only in a Windows 8 system. in 8.1 we get both speech and maps in the maps namespace. Is there any solution to this.


Solution

  • I've come across this before. It's likely that the speech API is overriding the Microsoft namespace. There are two options. The first is to add the Bing Maps script reference after the Speech reference. The Bing Maps SDK extends the Microsoft namespace and does not override it. The second option is to change the namespace of the Bing Maps control:

    • Add snippet before referencing sdk js files in html file as below:

      window.$MapsNamespace = 'MicrosoftJS';

    • Then replace the newly created custom namespace with ‘Microsoft’ as below:

      MicrosoftJS.Maps.loadModule('Microsoft.Maps.Map', { callback: createMap, culture: 'us', homeRegion: 'en-us' });