Warning: MapServiceToken not specified - c#

I have been making an UWP app with the using a MapControl but when I run the app I get an error in the bottom corner saying "Warning: MapServiceToken not specified". The XAML I am using is as follows:
<Maps:MapControl x:Name="MapControl1" Loaded="mapLoaded" ZoomLevelChanged="mapZoomChanged" MapServiceToken="AqK9nK0h_LngGSC8pHPzBJvl62yf617zRytgimB3fyYqdJPljcB-EGm3llmUUrlI"/>
As you can see I have specified the MapServiceToken and I have also tried specifying it using C# with no luck.
MapService.ServiceToken = "AqK9nK0h_LngGSC8pHPzBJvl62yf617zRytgimB3fyYqdJPljcB-EGm3llmUU...";
MapControl1.MapServiceToken = "AqK9nK0h_LngGSC8pHPzBJvl62yf617zRytgimB3fyYqdJPljcB-EGm3llmU...";
I have used www.bingmapsportal.com to get my token but I have also tried using the Application ID and Authentication Token from the Windows Dev Center. Any Ideas?

NOTE: For those who may be using older keys from Windows 8 platform
There seems to be an issue updating old keys to the Universal Windows Platform type. I had a key that was created in 2014, but even after I updated the key to Universal Windows it still would not authorize when I placed the key in the MapServiceToken value of the XAML. (it seems as though the value of the key itself never changes when you change the type on the key, even though it should update with a new value)
In order to solve this you have to create a brand new application key and use that value instead, and then the Warning message will go away.

I got the same issue but here is my solution.
First navigate to https://www.bingmapsportal.com/Application. Find the link to create a new key.
On the form, fill in the Application type field. The available options are:
Dev/Test
Mobile Application
Website
Windows Application
Even though you are developing a Xamarin.Forms project (that is intuitively a kind of mobile app), you must choose Windows Application rather than Mobile Application. Why? The reason might be "UWP is an Windows Application". Period.
Failure doing so will trigger the warning.

Sign into the Microsoft Dev account and navigate to this URI
https://www.bingmapsportal.com/Application#
Here the Key can be obtained for Universal.
It can be set in the XAML MapServiceToken, works fine!

Also, you can sign in directly on Bing Maps to generate a key.
https://www.bingmapsportal.com/
My Account -> My keys
For UWP, this key is quite long.
FYI, when I added the key on XAML for MapControl using MapServiceToken property, the app crashed my computer. Then when I restarted it, the App run well. Oh dear me...

Read Microsoft documentation
https://learn.microsoft.com/en-us/windows/uwp/maps-and-location/authentication-key
Generate new key and add it in MapControl MapServiceToken. Its work for me.

Related

Cannot create valid ProvisioningTransportHandlerMqtt

I am trying to create a IoT DPS device with a symmetric key, For that to work, I need a ProvisioningTransportHandlerMqtt.
I have tried the console application fromlearn: https://learn.microsoft.com/en-us/azure/iot-dps/how-to-legacy-device-symm-key?tabs=windows&pivots=programming-language-csharp and I can provision devices with it.
I have tried making an interactive .Net notebook, and I can also provision devices from that:
The issue is only in my own cs file. When I try to run a similar line in a cs file the object is different:
The samplecode from Microsoft produces a valid transportHandeler:
I have no clue how to create a proper transportHandler. How do I get a proper ProvisioningTransportHandlerMqtt()?
Turned out including the DotNetty dlls in my app solved the issue.

Unity Play Games can't authenticate

I have a issue with play games services and unity.
I've done everything by the documentation. I'm a tester, testing is allowed and I've changed the sha1 in api console to the one used by the app. I'm using code from the docs and examples so here is a brief:
PlayGamesClientConfiguration conf = new PlayGamesClientConfiguration.Builder().Build();
PlayGamesPlatform.InitializeInstance(conf);
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.Activate();
Debug.Log("Authenticating...");
Social.localUser.Authenticate((bool success) =>
{
if (success)
{
Debug.Log("Welcome " + Social.localUser.userName);
}
else
{
Debug.Log("Authentication failed.");
}
});
When I build the app in development mode the Play Games popup appears, starts loading and disappears and gives me a Authentication failed message. But when I build the app without the development mode nothing happens and I get the authentication failed message instantly. And yes I'm the correct sha1 key.
Please help me
I did a number of things and finally got it to work. I cannot be sure if they all contributed to solving this issue so here I will list what I did, from greatest to least of my guess of their relevance:
Match the SHA-1 certificates. If you are using an app downloaded from Play Store use the "app signing certificate", else use the upload certificate. These are found in the Play Console under YourApp/Release Management/App Signing. As a note, if you are building from Unity directly to your device, you should make sure that you are building with the same key used to upload to Google Play. More info here
If you are using a custom config and are requesting things such .RequestServerAuthCode(false), you must create an additional Web App. Go to your console project, and under create credentials choose OAuth client ID, and then select Web App.
If using internal testing, make sure to authorize accounts in the Play Console under Game Services/Your App/Testing.
Try disabling Anti-Piracy in the Play Console under Game Services/Your App/Linked Apps/Your App. Only do this if you are testing app outside Google Play. I think if you are logging in using verified test accounts this doesn't matter.
Edit: Publishing Game Services is required even for testing.. at least that seemed to be the case for me to get it working.
Try clearing the cache of your App on your device, I ran into this problem again and this solved it for me.
I finally think I have got it fixed for good.. after nearly a month later. :o Hope this helps.
Google Services can be published/unpublished separately from your app.
Check if they are correctly published doing the following:
Google Play Console
Game services
Select your game
Publishing
Check if Game Services are published.

CngKey.Import on azure

var rawData = Convert.FromBase64String(_signingKey);
var cng = CngKey.Import(rawData, CngKeyBlobFormat.Pkcs8PrivateBlob);
I use this code to extract key, from embedded base64 string.
It works fine when I test it locally but when I publish on azure I get following exception:
WindowsCryptographicException: The system cannot find the file specified
(once again I'm not reading from any file)
I need this to communicate with apple apns for push notifications, is there any workaround?
And this happens only on free service plan, if I switch to basic plan it's working.
I ran into the same error after publishing an existing application to Azure. In my case the problem was solved after I set WEBSITE_LOAD_USER_PROFILE = 1 in App Services / App Name / Application Settings.
Setting WEBSITE_LOAD_USER_PROFILE to equal 1 in the Azure App Service configuration definitely got my remote iOS notifications working. Using dotAPNS for C# .NET I also needed to omit apns.UseSandbox().
It seems that it causes by there is no certificate attached in your Azure Mobile App. If it is that case, we need to upload the "Development" or "Distribution" SSL certificate to the WebApp. More info about how to send push notifications to iOS App, please refer to the azure document.
I've had a similar error trying to construct a X509Certificate2 from a byte array - worked fine locally but once I deploy to Azure Web App, I got the same and VERY misleading file not found exception.
The real issue turned out to be that there was no user store associated with the web service account. You can also get a similar error if there are permission-related errors with accessing the certificate store on Windows.
In any case - In my scenario I fixed the problem by using MachineKeySet:
new X509Certificate2(certRawBytes, default(string), X509KeyStorageFlags.MachineKeySet);
So, in your scenario, try something like:
var keyParams = new CngKeyCreationParameters
{
KeyCreationOptions = CngKeyCreationOptions.MachineKey,
};
CngKey.Create(CngAlgorithm.Rsa, keyName, keyParams);
Note: You may have to set a few parameters to get the above working. The Import method doesn't seem to support MachineKey - but you should be able to achieve similar outcome by using the Create method.
To add to #strohmsn's answer, you can also set the App Service settings with this value directly within Visual Studio on the Publish page for web apps: Right click on web app and select Publish, then select App Service Settings, and you can add setting properties there: WEBSITE_LOAD_USER_PROFILE = 1 in this case. See screenshot:
For making it works, I needed TWO things in AzureWebApp..
So my code is :
//I load the PrivateKey here
ReadedByte = System.IO.File.ReadAllBytes(strPathPrivateKey);
//create the RSA thing
RSA rsa = System.Security.Cryptography.RSA.Create();
//import the key. It crashed HERE with the 'System cannot find file specified'
rsa.ImportPkcs8PrivateKey(source: ReadedByte,bytesRead: out int _);
It works perfectly locally. But, to make it WORK on Azure Web App, I had to have those TWO requirements :
1 - the WEBSITE_LOAD_USER_PROFILE = 1 spoken in the discussion above and below
2 - The App Service Plan must include "Custom domains / SSL" !
...so No 'F1 Share Infrastructure' nor 'D1 Share Infrastructure'. The lowest Service plan that worked for me was 'B1 - 100 Total Acu'.
Maybe I have something wrong somewhere else in my code, or my 'RSA' choice is bad..anyway...
It now works!

Windows Phone - link to the publisher in the app store

I have created several windows phone apps and I would like to link to my publisher's page to show all of the apps that I publish. Note that I am developing my app for Windows Phone 7.x and up using C# and XAML.
UPDATE
What I would like to do is show the following publisher page: From within Windows Phone, navigate to the Windows Phone store, then select any app, then select the "more from <Publisher>" link. This displays a nice mobile view of all of that publisher's apps. But I can't figure out how to bring up that publisher page directly from within my app. Any help would be appreciated!
Option 1) Link directly to the URL for my publishers page (using a WebBrowserTask)
Issue) All links to the store seem to require the en-US language embedded in the URL. I'm concerned about what will happen to users in other countries/languages.
Example: http:/www.windowsphone.com/en-US/store/publishers?publisherId=Microsoft%2BCorporation
Is there a language independent way to link to a publisher in the store?
Option 2) Use the MarketplaceDetailTask to link to the publisher
Issue) From what I've seen, this can only be used to link to an app. I tried using my publisher GUID and got: Marketplace Error - We're sorry, but we can't complete your request right now.
MarketplaceDetailTask marketplaceDetailTask = new MarketplaceDetailTask();
marketplaceDetailTask.ContentType = MarketplaceContentType.Applications;
marketplaceDetailTask.ContentIdentifier = <My Publisher GUID>;
marketplaceDetailTask.Show();
Option 3) Use the MarketplaceSearchTask to link to the publisher
Issue) This allows searching the store with any string. The problem is, when I put my publisher name in the search string, other apps are shown in addition to mine. My publisher name includes a common word and any app with that word shows up.
MarketplaceSearchTask searchTask = new MarketplaceSearchTask();
searchTask.ContentType = MarketplaceContentType.Applications;
searchTask.SearchTerms = "<My Publisher Name>";
searchTask.Show();
Any thoughts or suggestions would be appreciated!
Thanks.
As you're targeting WP7+, unfortunately using the zune:search URI only works on WP8 as it relies on URI Schemes, which was not backported to WP7. Based on these two posts, I tried the following on your behalf:
zune://search/?publisher=Henry%20Chong;
And a bunch of other things, but it seems that only zune://navigate is available on Windows Phone 7 and that only allows you to load a specific app. (Perhaps someone who feels like opening reflector or on the Phone teams could comment here...)
Two other things I've come across that you can look into:
1) There used to be an undocumented Zune api that you could query the marketplace against; it looks like this has been replaced by the Marketplace Edge Service, which you could try and dig around for:
http://social.msdn.microsoft.com/forums/windowsapps/en-US/f5294fcb-f4b3-4b19-9bda-f49c6a38b327/marketplace-edge-service-query
2) You could add a specific unique keyword to all your apps and use the MarketplaceSearchTask, as suggested here by Matt.
Personally, I'd go with #2 because:
you never know when the Marketplace Edge Service will change
1 is not technically supported by Microsoft
you won't have to replicate the page you're trying to display
Of course, there's also nothing stopping you from creating your own "Apps by X" page for your app and maintain it yourself manually.
Best of luck!

App capability removed after pubblication

When I test my app on my device, by deploying it with Visual Studio directly from my pc to my phone, ad is showing. Then I published my app, and there the ad is not showing.
After some research, I found that my to show my ad correctly my app should have ID_CAP_WEBBROWSERCOMPONENT in WMAppManifest file. I noticed, by watching my app's details inside my developer dashboard, that that id_cap is being removed after publishing the app!
I'm not the only, one but I didn't find an answer.
Some posts:
http://social.msdn.microsoft.com/Forums/wpapps/en-US/a172dcb6-7e31-45a1-82f1-44bcd8aeac73/my-app-needs-idcapwebbrowsercomponent-but-marketplace-says-not?forum=wpsubmit
http://social.msdn.microsoft.com/Forums/wpapps/en-US/6e5c635d-fcb4-4156-97fe-c5153088bb91/ads-are-not-showing-im-my-published-app-they-worked-during-development-whats-up-with-that?forum=wpdevelop
Note that I'm working with XNA-Silverlight and using the DrawableAd associated with AdComponent.
I really don't know how to handle this problem. Maybe can I add the capability programmatically?
** EDIT **
I aknowledged that the manifest file is just used while debugging, when you submit an app, it's capababilities are recognized automatically. Here is the problem. I run the StoreKitTeste in Visual Studio as shown here: http://msdn.microsoft.com/en-us/library/windowsphone/develop/gg180730(v=vs.105).aspx#BKMK_UsingtheMarketplaceTestKittoDetermineApplicationCapabilitiesforWindowsPhoneOS71Applications
and in fact it doesn't recognize ID_CAP_WEBBROWSERCOMPONENT. How can I make him see that I need it?
** EDIT 2 *
I found here the same problem http://www.geekchamp.com/tips/be-careful-when-submitting-for-windows-phone-marketplace-an-app-that-uses-capturesource-class
It is related to microphone capability, how can I do the same with Webbrowsercomponent?
I just added: WebBrowser w = new WebBrowser(); somewhere and it recognized its capability.

Categories