Shoban Kumar shows off the promise that is the Universal Windows Platform, one app, multiple platforms…

Universal Windows 10 Platform (UWP) Sound Cloud Music App for Windows Phone & Raspberry Pi2

Windows 10 introduces an entirely new way of developing apps targeting multiple devices and it is called UWP apps or Universal Windows Platform apps. Instead of creating separate apps for different platforms, UWP apps run across all major platforms with minor code changes.

This article covers part 2 of our journey to develop a Windows 10 Universal App (UWP) that will run on most of the devices without any code change. In Part 1 , I wrote how the new Windows 10 controls allow us to target a wide variety of Windows devices with minimal code. With Adaptive Triggers and Custom App shell, we developed a simple Sound Cloud player that adapts the UI based on the size of the screen.

In this article, we will improve our app by adding more features and changing existing code to support Background Audio and Media Transport Controls. We will also deploy our app to both a Windows Phone and Raspberry Pi2 without any code changes.

This article is published from the DNC Magazine for .NET Developers and Architects. Download this magazine from here [Zip PDF] or Subscribe to this magazine for FREE and download all previous and current editions

Project Setup

The previous sample played the first track from the “likes” playlist from SoundCloud but it did not support Background Audio and had the following limitations:

1. Minimizing App stopped the play back

2. Default Media Controls (Keyboard, Screen etc) were hidden

3. Media Controls did not show Song, Album art etc


– Make the following changes to App.xaml.cs to declare a new SoundCloudUser object which we will use later to display profile details.


-Make the following code changes to MyBackgroundAudioTask.cs file.


– Update SoundCloudUser.cs file with the following code to add new properties which are used in Me.xaml file in MusicPlayer project.

Testing our Windows 10 Sound Cloud Music Player app

Press debug and test the changes and if there are no compile errors, you should see the changes in Profile, Likes and Now Playing Pages as shown here.


Windows 10 Application Deployment tool

Windows 10 Application Deployment tool (WinAppDeployCmd.exe) is a command line utility that can be used to remotely deploy Apps to Windows Mobile Devices.

Let us try to deploy Music Player App to a Windows Mobile.


Raspberry Pi 2

Let us deploy our Music Player app to a Raspberry Pi 2 which is running Windows 10 IoT Core and see how the App works in a complete new device family without any change.


Windows 10 IoT core can run only one App in the foreground. To increase the performance, the raspberry Pi version of the Music Player app can be simplified by removing the background Task and using MediaElement or playback as shown in the first part of this series.

[Click through for the entire post]

Source link