Windows Store app development

This post was started to address Windows Store app for Windows only, and it has evolved to address Windows Store app for both Windows and Windows Phone developed with the Universal Apps mode.

Get started.

Build apps and get rewarded(It was App Builder, now it is DVLUP).  Windows App Dev Center has many benefits. There used to be a monthly sweepstakes.

Windows Store App Development Portal (it will be merged with Windows Phone Dev Center)

Add ads seamlessly with Microsoft PubCenter.

Find a graphics designer to design logos if necessary.

Do not reinvent the wheel when using AppBar button ions. Visual Studio includes lots of useful and elegant AppBar button images for every project.  One can also use Segoe UI Symbols which can be gleamed through the complete list.  Here is another good refrence.

Before creating custom controls, check out Callisto and Win RT XAML Toolkit.

Using a tablet to test Windows Store app is very beneficial because it can be used to test how an app reacts to different orientations if the app chooses to support them.  Setting up a Windows 8 tablet (i.e. Surface RT) is fairly straightforward. (Important note: one must install the version of remote tools corresponding to the Visual Studio used for debugging.  In other words, installing remote tools for Visual Studio 2013 on a remote machine will not work if Visual Studio is used for debugging). 

One should add a link to a privacy statement for each app in the app description part of its submission.  It should also add a corresponding link in the Settings charm

To port a Windows Phone app to Windows Store, one needs to be familiar with the API mapping between these two platforms.

Use PreApps to generate buzzes before publishing an app.

API

Mashery

Windows 8 app cannot bind a property of a XAML control to a static property of a class.

The steps to create a new app based on the template of an existing one using VS:

  1. Go to Windows Store App Development Portal to reserve the app's name. This needs to be done first because the desired name could be already taken by others.
  2. Create the app with the reserved name.
  3. Add necessary references (e.g. libraries).
  4. Optional: add symbol "TEST" to the Debug configuration for testing IAP using CurrentAppSimulator, or simply use DEBUG as the flag for testing IAP.
  5. For testing IAP, copy folder "Data" from an existing app.  The Data folder has license.xml used for testing IAP.  Edit the Product tag to suit the new app, and this name will be used through the app in code related to the IAP  
  6. Copy relevant code from the existing App's app.cs and modify it for the new app.
  7. Create the privacy statement and help web pages corresponding to what is used in App_CommandsRequested.
  8. Create an online help document.
  9. Associate the app with Windows Store: rght click the project > Store Associate > Associate App with the Store... This leads to Windows Dev Center to create an app by reserving a name first, so the app project can be associated with it.
  10. Windows Dev Center, select the newly created app > Selling details > Fill out the form and click "Use the Windows Store in-app purchase system" to create an in-app offer (it can also be created by selecting "Services" from the app's home page)
  11. Windows Dev Center, select "12+ Suitable for ages 12 and older" for "Age rating and rating certificates" if the app has ads.
  12. Register the app at Microsoft Advertising pubCenter, and create an ad unit for the app. 
  13. Add UI:AdControl, Review control and AppBar (including Upgrade, Help and Comment buttons) to MainPage.xaml.  Use corresponding styles in StandardStyles.xaml under folder Common for Help and Comment buttons.  Generate corresponding event handlers in MainPage.cs.  The app should be able to be built by now.
  14. Copy common code region from the existing app's MainPage.cs to the new app.
  15. Start the real work - app specific code.
  16. With the app in good shpae, create logos for Package.appxmanifest > Application UI. Keep in mind that badge logos must be monochromatic
  17. Create the package for Windows Store.  It is the best to test the app with Windows App Certification Kit before submitting it for the first time.
  18. Log positive experience at an appropriate point..

It is convenient and reliable to set the DataContext of a XAML page its corresponding C# class so its controls can be bound to properites of the class.   To do this:

  1. Add the following attribute to the Page tag: DataContext ="{Binding RelativeSource={RelativeSource Self} }"
  2. Implement interface  INotifyPropertyChanged.
  3. For every property add the following to the set method: NotifyPropertyChanged("PropertyName");

Tidbits:

RenderTargetBitmap does not work for CaptureElement, so streaming video window cannot be captured. 

Package.appxmanifest is used for creating the package of an app.  Running the app from VS cannot test it.  The only way to test it is using Windows App Certification Kit.

SQLite is the preferred local database for Windows Store app, but its currend SDK does not support "Any CPU" compilation.  This means that one has to submit 3 packages for every release of an app (x86, x64, ARM).  Fortunately, VS can take care of all three packages with one build. The downside is that one has to switch the target platform if he needs to test the app on a computer with a different architecture.  This can be done with one button-click.  To use this in a project: install sqlite-net via NuGet, download  Precompiled Binaries for Windows Runtime and install it, reference SQLite for Windows Runtime(Windows 8.1) in Windows > Extensions  with Reference Manager.

To implement a class for customMediaSink in MediaCapture.StartRecordToCustomSinkAsync(MediaEncodingProfile encodingProfile, IMediaExtension customMediaSink) with C# is impossible or nearly impossible. The documentation for such implementation is essentially non-existant.  One needs to support interface IMFMediaSink even though it is completely missing in the document for IMediaExtension.  Some samples (1, 2) are nice, but they really show the clumsiness of implementing custom video sink.

A file in a Universal Apps project may use conditional compilation symbols such as WINDOWS_PHONE_APP.  If the project uses a class library, the symbol is not passed to the library in compilation by default. To remedy is creating a solution configuration (not project configuration), then add relevant symbols to proejct all platforms for this solution configuration for both libraries and the project.  For example, create a solution configuration called DebugWP by copying from the Debug configuration, then go to the Build tab of the properties windows of the project and libraries to add WINDOWS_PHONE_APP to the conditional compilation symbols for All Platforms. After this, WINDOWS_PHONE_APP is passed to all libraries. 

The simplest Windows Phone app that does nothing uses about 7 MB memory.  In other words, the minimum memory consumption is 7 MB