23.01.2018 Views

MICROSOFT_PRESS_EBOOK_PROGRAMMING_WINDOWS_8_APPS_WITH_HTML_CSS_AND_JAVASCRIPT_PDF

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Be aware that Sections 4.8 and 4.9 of the Store certification requirements apply here, where you need to<br />

ensure that the user enters credentials for each purchase and that each transaction meets the PCI Data<br />

Security Standards.<br />

With this custom commerce option, you’re pretty much on your own where all the details are<br />

concerned, including UI—the Windows Store API itself doesn’t provide for extensibility of its own<br />

mechanisms. You might draw from The in-app purchase user experience for a customer topic in the<br />

documentation to understand the flow, and you may also be able to find a third-party solution that<br />

provides an app control along with the backend commerce services.<br />

Note that although the Windows Store does not presently support consumable in-app purchases,<br />

you can certainly implement this with your own commerce scheme. Doing so will also avoid the<br />

100-item limit imposed by the Windows Store mechanisms.<br />

The Windows Store APIs<br />

Now that you’ve likely decided on a course for your app, let’s see how you use the Windows Store APIs<br />

to accomplish those ends. These are found in the Windows.ApplicationModel.Store namespace; all<br />

objects referred to in this section are contained in this namespace unless noted. 80<br />

First, know that basic licensing and trial enforcement comes for free: the app doesn’t actually need to<br />

do anything at all! A user cannot acquire your app without going through the Store, and even if he did<br />

manage to, he’d have to have a developer license to install and run it. Furthermore, because the Store<br />

automatically tracks trial periods for apps, Windows will simply not launch an app once the trial is<br />

expired. Instead, Windows will redirect the user to the product’s page in the Store where the user can<br />

purchase a full license.<br />

An app can also set the expiration time of a license—not just for trials but the full app. This could be<br />

useful for apps that aren’t valid or useful after a given date, such as event registration (conferences,<br />

meetings, etc.) or time-limited demos. Think about it, though: if the user has gone to the trouble of<br />

acquiring the app in the first place, do you really want to go and disable it? Far better, I imagine, is to<br />

maintain the usefulness of the app in some way. With event registration, for example, there are<br />

probably more events in the future that you could provide information about and perhaps open up<br />

registration at the appropriate time. Again, the user has the app already and must have had some intent<br />

in launching it even after it’s expired—so can you leverage that intent in some way? It’s a good question<br />

to ask.<br />

As noted before, apps can enforce a secondary licensing scheme if desired. Here it would ask the user<br />

for a separate registration or a separately acquired license key of some sort. Again, Windows does not<br />

offer an API for this but will not block schemes of your own.<br />

80 To make a note, the Windows.ApplicationModel.Package class also provides a few details about the installed app<br />

package. Usage is simple, and you can refer to the App package information sample for more.<br />

768

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!