Windows : Adding privacy URL to charm settings

After more than a month of hardcore designing,coding,animating,testing etc., on my game(soccer),i thought its time to push it to Windows store.

I have done almost everything required (will write in my next post) to make it compatible with windows 8/8.1 . Then,I took this to windows app lab for a quick review.There comes my friend Ujjwal,he says you missed adding the privacy charm !!! without this it will not pass the store review.

ufff!! ok calm down…its just one small thing to achieve then started searching for some code snippets to quickly do this…

Got some….but they didn’t work…few of them were throwing errors….Then after 1 hour of (re)search…alas!!! i made it work and i could see privacy charm on the settings of my game on windows 8…..

C#/XAML

1) In your App.xaml.cs,

Add above the namespace

using Windows.UI.ApplicationSettings;
using Windows.UI.Popups;

2) Add the below line to your app initialization /onLaunched event

 SettingsPane.GetForCurrentView().CommandsRequested += SettingCharmManager_CommandsRequested;

3)Add these methods to your class

private void SettingCharmManager_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
args.Request.ApplicationCommands.Add(new SettingsCommand("privacypolicy", "Privacy policy", OpenPrivacyPolicy));
}

private async void OpenPrivacyPolicy(IUICommand command)
{
Uri uri = new Uri("https://onestopdotnet.wordpress.com");
await Windows.System.Launcher.LaunchUriAsync(uri);
}

Sample Privacy Policy 

privacy charm

It worked like a Charm 🙂

Advertisements

One thought on “Windows : Adding privacy URL to charm settings

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s