.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> Metro Apps >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Adding Privacy Setting to Charm Windows 8 JavaScript Applications

Posted By:Ravi Ranjan Kumar       Posted Date: November 28, 2013    Points: 200    Category: Metro Apps    URL: http://www.dotnetspark.com  

This blog enables you to learn how to add privacy settings to charm using Windows 8 JavasScript applications.
 

Problem

Have your Windows 8 app certification ever failed just because of privacy-related requirements? During the certification process have you ever got a message stating that "The app has declared access to network capabilities and no privacy statement was provided in the Windows Settings Charm"? If the answer is yes, it means your app is not fulfilling the certification requirement 4.1: "Your app must comply with the following privacy-related requirements: Your app must have a privacy statement if it is network-capable, and your app must obtain opt-in or equivalent consent to share personal information". For more details check here: 4.1 Your app must comply with the following privacy-related requirements.

Solution

It is not so complex to solve this problem. Infact you don't need to worry about lines of coding. You can solve this issue by writing only a few lines of code. First of all you need to create a new HTML file including a privacy statement and the second one is implementing/adding this HTML file to the default.js file.

Let's see how can we accomplish task step by step.

Step 1: Create a HTML file stating your Privacy Policies

<div id="privid" data-win-control="WinJS.UI.SettingsFlyout" style="background-color: black;">
This application does not share personal information with third parties nor does it store any information about you. 
This privacy policy is subject to change without notice and was last updated on [INSERT DATE]. If you have any questions 
feel free to contact me directly at <a href="mailto:[Your EMAIL ADDRESS]">[Your EMAIL ADDRESS]</a>.
you can also mention your link for users to navigate
<a href="//www.google.co.in"">Click Me!</a>
</div>
Step 2 : Adding Privacy.html in default.js.


Code to Implement :

app.onsettings = function (args) {
    args.detail.applicationcommands = {
        "privid": {
            title: "Privacy Policy", href: "pages/settings/privacy.html"
        }
    };
    WinJS.UI.SettingsFlyout.populateSettings(args);
};

The default.js file will look like:

// For an introduction to the Blank template, see the following documentation:
// http://go.microsoft.com/fwlink/?LinkId=232509
(function () {
    "use strict";

    WinJS.Binding.optimizeBindingReferences = true;

    var app = WinJS.Application;
    var activation = Windows.ApplicationModel.Activation;

    app.onactivated = function (args) {
        if (args.detail.kind === activation.ActivationKind.launch) {
            if (args.detail.previousExecutionState !== 
                         activation.ApplicationExecutionState.terminated) {
                // TODO: This application has been newly launched. Initialize
                // your application here.
            } else {
                // TODO: This application has been reactivated from suspension.
                // Restore application state here.
            }
            args.setPromise(WinJS.UI.processAll());
        }
    };

   // Code to implement Privacy policy
    app.onsettings = function (args) {
        args.detail.applicationcommands = {
            "privid": {
                title: "Privacy Policy", href: "pages/settings/privacy.html"
            }
        };
        WinJS.UI.SettingsFlyout.populateSettings(args);
    };

    app.start();
})();

You are done with all the steps. Now check your code to verify it is running well. Look below, here I've posted a screenshot of the demo app.

Move your mouse to the right corner of the screen and click on Setting. You'll get this:

Click on "Privacy policy" to see privacy policies.

Happy coding :)


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend