This is a migrated thread and some comments may be shown as answers.

OutOfMemoryExceptions on Tile Updates

6 Answers 53 Views
LiveTileHelper
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nachiket
Top achievements
Rank 1
Nachiket asked on 07 Jul 2014, 04:31 PM
Hi,
I am receiving a lot of Crash Reports for my App "Battery.Net Pro" on windows phone 8 store. After analyzing the Crash Reports from dev center. It seems like 90 % of these crashes are in the background agent on this line of code. 

"BackgroundAgent.TileHelper.UpdateLiveTile"

I have tried to optimize my background agent and seen that the Memory used by app before this line of code is about 6 Megs. This is an in-frequent error. Does not happen always, but surely affecting the user experience and it is getting bad reviews for my app. 

This is the stacktrace. 
"0        telerik_windows_backgroundagenttools_ni    Telerik.Windows.Controls.PngEncoder.PNGWriter.WriteDataChunksUncompressed                     0x000000b4    
1        telerik_windows_backgroundagenttools_ni    Telerik.Windows.Controls.PngEncoder.PNGWriter.WritePNG                                        0x000000ba    
2        telerik_windows_backgroundagenttools_ni    Telerik.Windows.Controls.LiveTileHelper.SaveTileImage                                         0x0000006c    
3        telerik_windows_backgroundagenttools_ni    Telerik.Windows.Controls.LiveTileHelper.SaveImageFromVisual                                   0x0000015a    
4        telerik_windows_backgroundagenttools_ni    Telerik.Windows.Controls.RadFlipTileData.Telerik.Windows.Controls.ITileData.CreateTileData    0x00000132    
5        telerik_windows_backgroundagenttools_ni    Telerik.Windows.Controls.LiveTileHelper.UpdateTile                                            0x0000003e    
6        backgroundagent_ni                         BackgroundAgent.TileHelper.UpdateLiveTile                                                     0x000001f6    
7        backgroundagent_ni                         BackgroundAgent.BackgroundTask+__c__DisplayClass5._OnInvoke_b__2                              0x00000024"


Can you please help ?

Thanks,
Nachiket

6 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 10 Jul 2014, 02:17 PM
Hi Nachiket,

Can you send us an example, which reproduces the problem? I understand it does not happen all the time, but having a project which reproduces the error would be really helpful for us to investigate the possible reasons and provide a fix. Thank you.

Best regards,
Ves
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Nachiket
Top achievements
Rank 1
answered on 14 Jul 2014, 05:52 PM
Hi Ves,
Thanks for your reply. I cannot send you the project, entirely and the just the background agent code piece wont work without entire solution. 
However I will try to give you all the information about what I do in background agent here.

"
RadFlipTileData flipTileData = new RadFlipTileData();
                    flipTileData.Count = 0;
                    flipTileData.Title = "";

                   

                    flipTileData.MeasureMode = MeasureMode.Element;

                    flipTileData.IsTransparencySupported = true;

                    flipTileData.SmallVisualElement = GetSmallFrontVisualContent(DbManager);

                    flipTileData.VisualElement = GetMediumFrontVisualContent();

                    flipTileData.BackVisualElement = GetMediumBackVisualContent();

                    flipTileData.WideVisualElement = GetWideFrontVisualContent();
                    flipTileData.WideBackVisualElement = GetWideBackVisualContent();


                    LiveTileHelper.UpdateTile(appTile, flipTileData);
"
Inside each method which returns a visual element I am creating a container Grid with the following dimensions
 ///Small 159 x 159
            ///Medium 336 x 336
            ///Large 691 x 336
and it inside grid there will be an image element for the Icon and a few textblocks and stack panels in a few tiles. Nothing crazy.

I have attached a screenshot of 3 types of tiles. Please let me know if this should be enough information or you need more. 






0
Ves
Telerik team
answered on 17 Jul 2014, 03:26 PM
Hi Nachiket,

The LiveTileHelper saves images of the UIElements that you pass to it. If IsTransparencySupported is set to true, the images are saved in .png format and if it is set to false, they are saved as jpg-s. The png format takes significantly more memory than the jpg, so if you save in png from a BackgroundAgent you may hit the memory limits. Background agent has this limitation of 20MB memory usage on 1GB device and 11MB for devices equipped with less memory.

If you need to update the tile from an agent, you may have to disable the transparency (i.e. use .jpg) and/or the wide tile size so that you reduce the memory consumption. In addition, please make sure that the images provided within the visual element are not larger than their actual display size i.e. you do not need an 600x600 image to show it in a small tile.


Best regards,
Ves
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
ckruhs
Top achievements
Rank 2
answered on 04 Aug 2014, 05:36 PM
Hi Nachiket,
Did you find a solution for this issue? I struggle with the same problem.
Even if I use IsTransparencySupported = false the Live Tile is sometimes corrupt.
That also happens if I update the Live Tile when closing the app.

Best regards
ckruhs
0
Nachiket
Top achievements
Rank 1
answered on 27 Jan 2015, 08:30 PM
Hi Ckruhs,
No I have not yet found the solution for this. I have seen improvement on lower memory devices when I set IsTransparentcySupported to False. 
I think you are talking about corrupt tiles. It may be something else. Because In my case I either get the tile updated or not. When its updates it is fine. When it fails, my tile doesnt not change.

Please check if you are calling "UpdateLayout()" on the visual elements when you update the LiveTile. 

-Nachiket
0
ckruhs
Top achievements
Rank 2
answered on 02 Feb 2015, 08:22 PM
Hi Nachiket,
Thanks for the update.

Best regards
ckruhs
Tags
LiveTileHelper
Asked by
Nachiket
Top achievements
Rank 1
Answers by
Ves
Telerik team
Nachiket
Top achievements
Rank 1
ckruhs
Top achievements
Rank 2
Share this question
or