How to Check for Network Availability in Universal Windows apps

If you are building a universal Windows app or an app for Windows Phone 8.1/Windows 8.1 then the following class can help you check for network availability.

Network Availability class

This is a singleton class, which means only a single instance of it will exist during the lifecycle of the app.

The method NetworkInformationOnNetworkStatusChanged gets called whenever the network status changes. This method in turn updates the IsNetworkAvailable property with the current network profile information.

Usage

Whenever you need to check if the network is available, simply use:

Save Speech Synthesis Stream as Audio in Windows Phone 8.1

In Windows Phone 8.1 you can generate a SpeechSynthesisStream using text to speech. We earlier tipped you on
Using text to speech in Windows Phone 8 and 8.1
You can use the output SpeechSynthesisStream and save it as a .wav audio file in app’s local storage.

Note

This is not the best method to save the speech stream to audio as it takes a long time to get processed.

Sound off in comments/forums if you find a workaround.

UPDATE: We just found another method to do it and it seems to be quite faster. The sample Transcoding media project uses Windows.Media.Transcoding API to transcode a media file in a Windows Store app.

AppBar in Windows Phone 8.1 and 8.0 app

In Windows Phone 8.1, We can use BottomAppBar to add AppBar. Usually we use CommandBar to create basic BottomAppBar. CommandBar contains two collection: PrimaryCommands and SecondaryCommands, It’s similar with shell:ApplicationBar.Buttons and shell:ApplicationBar.MenuItems in Windows Phone 8.

If you are working on a Windows Phone 8/Windows Phone 8.1 Silverlight application then use the the following XAML code.

If you need in depth details on Windows Phone 8 app bar then refer to this MSDN article.

Hiding the Status Bar in Windows Phone 8.1 apps

Its not always recommended to hide the status bar but sometimes it may be a necessity. Its quite simple in Windows Phone 8 Silverlight apps where you can just set the status bar to False and hide it. Its a bit tricky in windows phone 8.1. Here’s how it can be done.

If you want to make use of the Status Bar part of the screen, use this code in the MainPage() constructor (or whatever page you are displaying):

If you want to hide the status bar then use the code in hide.cs and call the function from the MainPage constructor