1. SpielerB's Avatar
    Hi there,

    is it possible to create LiveTiles using a WritableBitmap within a PeriodicTask in Windows Phone 8? I am trying to to display contact photos on my app's LiveTile but got frequent OutOfMemory exceptions in the PeriodicTask while using WritableBitmap. The total available memory seemed to be 11mb, I thought this is the restriction for low memory devices (I tested on a Samsung AtivS), how can I opt for more memory?

    Than I thought it might be okay to use the ResourceIntensiveTask instead - haven't tried it out yet - but reading the Microsoft doc, it seems like the ResourceIntensiveTask has the same memory restrictions?

    Has anybody experiences on such a topic? Any help would be appreciated!

    Thanks a lot & Best regards,

    01-28-2014 03:11 AM
  2. nemecek_f's Avatar
    Hello, are you rendering new images? Bunch of apps create tile images with background agents so it should be possible. Maybe your problem lies elsewhere. Loading images into bitmap usually consumes a lot of memory.

    As for ResourceIntensiveTask, this one has more strict requirements. It probably runs only if phone battery is in good state and there are also other conditions. I don't know them from memory.
    01-28-2014 03:20 AM
  3. SpielerB's Avatar
    the method Microsoft.Phone.UserData.Contact.GetPicture returns a stream which I set to the BitmapImage, so yes, I am rendering new images... but I do not see any other possibility to render the Contact.GetPicture stream?!

    ResourceIntesiveTask has some restrictions like only if connected to WLAN which does not make any sense in my use case... I just would like to know if this task has the same memory limit? Than I could think about a workaround...

    Any other ideas?

    01-28-2014 04:43 AM
  4. nemecek_f's Avatar
    Ok, are your rendering that image from one contact or from multiple? If you are using only one contact, you could try to just save the image to Shared/ShellContent without rendering. Here you can find bunch of tips how to limit memory usage when working with images - c# - Windows phone: listbox with images out-of-memory - Stack Overflow Images in Windows Phone are tricky area :)

    All types of scheduled agents can use up to 20 MB memory and + 5 MB more if handset is running GDR3. That could be enough. While rendering image in-app I managed to consume 28 MB.
    SpielerB likes this.
    01-28-2014 05:00 AM
  5. SpielerB's Avatar
    Multiple, everything else would have been too easy

    Thanks for the link! I will try out the given tweaks there (nulling ImageSource, etc...) actually I was already calling GC.Collect in between to get more memory.

    Still I am surprised: DeviceStatus.ApplicationMemoryUsageLimit returns ~11mb during my debugging session?!

    If everything fails, I will pre-create the tile-images while the app is running in foreground and than just set the right one in the periodic task. This would mean that the user has to start the app at least every 2nd or 3rd day...
    Last edited by SpielerB; 01-28-2014 at 08:03 AM. Reason: typo
    01-28-2014 07:34 AM

Similar Threads

  1. BING sucks everywhere except america
    By colinkiama in forum Bing
    Replies: 15
    Last Post: 01-23-2014, 08:09 AM
  2. Love everything Except..... No flash!
    By jefbeard911 in forum Huawei Ascend W2
    Replies: 5
    Last Post: 12-07-2013, 10:56 AM
  3. Blocking all data except for facebook
    By billybrown in forum Windows Phone 7
    Replies: 1
    Last Post: 10-05-2013, 08:53 PM
  4. Replies: 4
    Last Post: 09-04-2013, 08:50 AM
  5. Deleting photos except favorites
    By Quantify in forum Windows Phone 8
    Replies: 1
    Last Post: 07-21-2013, 01:42 PM