Category Archives: WP8

New API for changing Start screen background image in Windows 10 v10166

Windows 10 Insider Preview v10166 was just recently released for PCs and Phones, together with related SDK.

In this short article I’ll show you how to use new API for changing Desktop/Start screen background image, that is first available in this version.

 

The API is located in new class UserProfilePersonalizationSettings in the Windows.SystemUserProfile namespace. It has currently only few members:

public sealed class UserProfilePersonalizationSettings : IUserProfilePersonalizationSettings
{
    public IAsyncOperation<bool> IUserProfilePersonalizationSettings.TrySetLockScreenImageAsync(StorageFile imageFile);
    public IAsyncOperation<bool> IUserProfilePersonalizationSettings.TrySetWallpaperImageAsync(StorageFile imageFile);
    public static bool IsSupported();
    public static UserProfilePersonalizationSettings Current { get; }
}

For changing the background image you just need to get StorageFile of your image and call TrySetWallpaperImageAsync and that’s all. Complete code sample could look like this. Note I have placed newbg.jpg image in the root folder of my project and set the compile option to Content:

private static async Task ChangeStartWallpaper()
{
    if (UserProfilePersonalizationSettings.IsSupported())
    {
        StorageFile newBg = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///newbg.jpg"));
        UserProfilePersonalizationSettings ups = UserProfilePersonalizationSettings.Current;
        await ups.TrySetWallpaperImageAsync(newBg);
    }
}

I’ve tested this API just now and it works both on phone and PC. Strangely it works immediately, no question asked. There should probably be some kind of dialog or settings that only selected app can change these image. I can imagine two apps fighting to change the background images in background tasks.

That’s all for now. I really like this simple new API that will make a great addition to my Windows and Windows Phone apps Astronomy Image of the Day that already can change the lockscreen image with daily astro photo.

#WPdev Quick tip – API for accessing Windows Store from your app

Following the previous WPdev quick tip how to initiate Email Compose from your app, here is another API that developer often need:

  • Navigate to Rate and Review dialog for the current app – if you want to initiate app rating from the current user
  • Navigate to Windows/Phone Store to the currently running app – if you want the user to purchase full version of current app or upgrade to a new version
  • Navigate to Windows/Phone Store to all apps published by the current developer – if you want to encourage the user to download other of your apps

Unfortunately all these tasks require different type of API in Windows Phone 7.5/8/8.1 Silverlight apps, in Windows 8.1 apps and another one in Windows Phone 8.1 WinRT apps and since I needed all these methods in my recent Windows Universal App NASA TV Live, I decided to put it all into short article for future use, so here it is:

Continue reading

Windows Phone 8.1 SDK, 9 month later, what’s new

The Windows Phone 8.1 SDK was released with a bang at the beginning of April 2014 and the OS update arrived later that year. It brought lot of new to the Windows Phone ecosystem, but also caused a noticeable disarray to the Windows Phone community and to the community of developers as well. Some features in WP8.1 are definitely great and improving, some are just worrisome, and some features in WP8.1 SDK are simply missing, even though they were in WP8.

Let’s take a look on the WP8.1 SDK nine months after the original release, what improvements it brought and also what’s still not there.

In this dev article about Windows Phone 8.1 SDK, 9 month later I’ll summarize in few bullet points the most interesting features of this OS update and especially what’s new for developers.

Continue reading

New API in Windows Phone 8.1 Update 1

Accessory-App-Windows-Phone-348x620As a part of the “Preview for Developers” program Microsoft just recently released the first larger update for Windows Phone 8.1 called just “Windows Phone 8.1 Update” with OS version number 8.10.14147.180. The original Windows Phone 8.1 was 8.10.12359.845.

According to MSDN blog article this update brings primarily these new end user features:

  • Cortana is now available for couple of new countries
  • Live Folders – native implementation of app folders on the Start screen
  • Option to simply select multiple SMS messages for deleting/forwarding
  • Apps Corner, Private VPN, Store Live Tile, Internet sharing via Bluetooth, customizable snooze time for Alarms and more.

But probably the most interesting feature, that might be part of this update as well, is is the support for notification on accessories, typically on smart watches and other wearables. The best hint for this functionality is already in the phone settings – the new “accessory apps” section.

The second hint is the new available API, that’ll be shown in the rest of this article.

Continue reading

File IO Best Practices in Windows and Phone apps – Part 1. Available APIs and File.Exists checking

Working with files is one of the most common tasks when developing any Windows Phone or Windows apps. In this mini-series of articles I’ll show you available APIs in all Windows Phone and Windows versions, caveats when doing task such as checking if specific file exists, getting target file, reading writing data from/to files and also how to effectively extract data from ZIP files, and more.

In the first part of this series I’ll discuss available File IO APIs in Windows Phone 8, 8.1 Silverlight, 8.1 XAML, Windows 8 and 8.1 platforms and benchmark all available methods for testing, if target file in Local Folder exists, or not. To my great surprise, the performance of methods in StorageFolder API is dramatically different across different platforms and it’s not a good idea to use single approach everywhere.

Continue reading

WPdev know-how in my open sourced app Bugemos

Capture1

Just today I’ve published one of my first Windows Phone application Bugemos as Open Source on GitHub.

The app, that I created and published to Windows Phone Store back in late 2011, is just a simple RSS reader displaying latest comic strips from the web http://www.bugemos.com. The reason I’m publishing it as Open Source is that I think it might give a helpful insight to starting WP developers and to the community as well. Note the published source code is not the exact one, that was used in the currently published app. The app was updated from WP7.5 to WP8 and also instead of original AsyncCTP it now uses current Microsoft.Bcl.Async NuGet package.

So let’s see, how is the application designed and what it does.

Continue reading

New API in Windows Phone 8 GDR3

In this article I describe new developer APIs available in Windows Phone 8 GDR3/Update 3, at the time of writing this article the latest official version of Windows Phone OS.

First of all, GDR3 brings officially no new API, only minor changes in OS behavior, support for 1080p devices, devices with 2GB of RAM, couple of new Uri schemes and that’s basically it. But what you might have noticed last week, Pedro Lamas described in his article  Disabling screenshot functionality in a Windows Phone app one undocumented new property

  • PhoneApplicationPage.IsScreenCaptureEnabled

After reading that article I was wondering, if there are another new APIs available in the GDR3 update, that can be accessed by reflection, so I stared my analysis.

Continue reading

What to expect from Microsoft in 2014, Part 1. Windows Phone

In my first article of what to expect from Microsoft in 2014, I’ll gather my thoughts regarding the Windows Phone platform.
As we already know, there was no major update of WP platform in 2013. The last major update was WP8 in November 2012 and since then we have only seen minor updates called GDR1,2 and 3, or in Microsoft terms Update 1,2 and 3. These brought some small fixes and features asked by users + support for quad-core ad FullHD devices, but overall nothing breathtaking.

The year 2014 will be different. We can say almost for sure, that Microsoft will deliver the long awaited update with codename “Blue” and expected name Windows Phone 8.1. This update might be first mentioned on Mobile World Congress in February and maybe delivered as a beta version shortly after, or no later than after the BUILD 2014 conference in the early April 2014. Similarly to WP7.5 “Mango” that Microsoft delivered in 2011, WP8.1 should be available to all existing WP8 devices.

Beside WP8.1 we won’t see most likely anything new that year, maybe only some kind of GDR5 update filling the gaps and bugs in not yet fully polished WP8.1 RTM version.

What to expect in WP8.1 from user’s perspective?

This is my personal list of user features that we might expect in this update, sorted by my subjective probability.

Continue reading

Tip: hiding programatically the “volume bar” controls on Windows Phone 8

windows-phone-volume-bar

Just a simple tip, what I just discovered recently – you probably know that when you play any music file or tune FM radio station on Windows Phone 8, this volume bar controls appear, when you press Volume Up/Down buttons. But even when you stop the music playback, there is no simple way, how to remove this media playback bar.

But since there is already at least one app, that can remove this Volume bar, I was wondering, how to do it in C# as well.

After couple of minutes tinkering with the MediaPlayer class I’ve discovered the solution, and it’s pretty easy:

  • You need to add into your app empty file with .wma extension and set the build action as “Content”, for instance “empty.wma” into the app root folder.
  • To stop the media playback and remove the media player just create dummy Song object and try to play it like this:
Song s = Song.FromUri("empty", new Uri("empty.wma", UriKind.Relative));
MediaPlayer.Play(s);

And that’s all 🙂
Note I’ve tested this only on Windows Phone 8 device with GDR3 update, but I guess it will work on WP7.5 as well.