locked
Lockscreen problems on 8.1 RRS feed

  • Question

  • The problem with putting out apps for WP 8.1 right now, is if anything goes wrong, your app takes the bad reviews!

    I am getting several users reporting that the lock screen image is not displaying on Windows Phone 8.1 preview. All they see is the image that gets packaged with the app before the app has called SetImageUri().

    My app now targets Sliverlight 8.1, but otherwise there are no code changes for the lock screen, and all worked perfectly for Windows Phone 8. It is also not all instance of 8.1 that have a problem; my own 925 does not suffer from the problem.

    Anyone have any insights into what is causing this? It is super annoying.

    Monday, May 5, 2014 5:54 PM

All replies

  • What does your sample code/ repro look like? Can you share?

    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog


    Monday, May 5, 2014 9:52 PM
  • Here is a cut down version of the code that updates the lock screen. Note that the existing code in the app is trapping some exceptions around the SetImageUri() call, since this would on occasion, in WP8, through in-explicable exceptions about not having permission to set the image. I have removed that to find out what exceptions might be thrown in WP 8.1.

            private const string LockScreenImageUri = "ms-appdata:///Local/{0}";
    
            private const string LockScreenImageName1 = "lockscreen1.jpg";
    
            private const string LockScreenImageName2 = "lockscreen2.jpg";
    
            ...
    
            if (!LockScreenManager.IsProvidedByCurrentApplication)
            {
               return;
            }
    
            var image = GetLockScreenImage();
            var currentName = GetImageName();
    
            SaveImage(image, currentName);
    
            var imageUri = new Uri(string.Format(CultureInfo.InvariantCulture, LockScreenImageUri, currentName), UriKind.Absolute);
    
            LockScreen.SetImageUri(imageUri);
    
            ...
    
            private string GetImageName()
            {
                uri = LockScreen.GetImageUri();
    
                var hour = DateTime.Now.Hour;
    
                return string.Format(CultureInfo.InvariantCulture, "{0}{1}", hour, uri.ToString().EndsWith(LockScreenImageName1) ? LockScreenImageName2 : LockScreenImageName1);
            }
    
            private static void SaveImage(WriteableBitmap wbmp, string name)
            {
                using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    using (var stream = store.CreateFile(name))
                    {
                        wbmp.SaveJpeg(stream, wbmp.PixelWidth, wbmp.PixelHeight, 0, 85);
                    }
                }
            }
    
    

    Tuesday, May 6, 2014 6:18 AM
  • The problem seems to be when placing the app onto external storage SD. It is causing the AgrumentException in LockScreen.SetImageUri(). I sure hope this can be fixed before public release.
    Thursday, May 22, 2014 6:21 PM
  • Can you share a complete simplified repro via OneDrive/DropBox so that we can repro the issue here and try to analyze where the issue is?

    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Thursday, May 22, 2014 7:20 PM
  • I have spent days on this problem and re-written my code in many ways to work around the exception. I cannot actually repro it on my test phone since it does not have an external storage possibility (Nokia 925), but my customers do.

    Now, my code is more or less identical to the sample code for displaying a Lock screen image, which is on MSDN (I just create the image first using a writeablebitmap then save it in app local store in the root). I think you can repro it with that code, if you have an appropriate device. I already simplified it and quoted it above, but with 0 interest from the community.

    The exact same code that worked in WP8 failed on WP8.1. I realize it is a developer preview, but users do not care about that, and as usual they blame the app not the OS. So not happy. Honestly, I don't feel like doing even more work in this to provide you with a simple repro. I really think your team is able to do that work yourself; if not then I guess it does not get fixed.

    Thanks.

    Thursday, May 22, 2014 7:35 PM
  • I can confirm that this is still happening in the Denim Release, on a Lumia 635 not running developer preview.

    The problem can only be avoided by prevent your app from being installed on an external SD card.

    http://english.r2d2rigo.es/2014/08/25/lockscreen-setimageuri-fails-sometimes-on-windows-phone-8-1-devices/


    Anthony Wieser | Wieser Software Ltd | www.wieser-software.com


    Thursday, April 16, 2015 4:19 PM