UWP: Phone status bar issue in Insider builds

Recent Insider builds seem to have a problem with the status bar on UWP programs that I’ve written and deployed via Visual Studio.  The status bar appears with white text and white background (I use the Dark theme).  I’ve found the following fix for it.

  1. Add a reference to Windows Mobile Extensions for UWP in Universal Windows Extensions.  I use version 10240 for backwards compatibility but I could easily use the 10586 version since I always run Insider builds on my phone.
  2. Add the following code to the bottom of the OnLaunched event:
// STATUS BAR FIX
 if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
 {
 var statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
 statusBar.BackgroundColor = Windows.UI.Colors.Black;
 statusBar.BackgroundOpacity = 1;
 //statusBar.HideAsync();
 }

This forces the background to black which correctly displays the white status text and icons.  Also note that there is the ability to hide the status bar but I don’t use that.  Of course, if you are using the Light theme this change would probably break it in the reverse manner.  But since I use Dark and the programs I’ve written are only for personal use this fix works for me.