locked
WinRT information: Could not initialize secondary tile with provided arguments. RRS feed

  • Question

  • hi,

    I am using windows Azure blob container to store all the images. here I am getting this exception:

    WinRT information: Could not initialize secondary tile with provided arguments.

    this is due to image urls format. how can I get that images from blob container from web to my local folder and how can I give that url.

    this is my code for secondary tile :

    private asyncvoidOnPinRecipeButtonClicked(objectsender, RoutedEventArgse)

    {

    varitem = (Appetizerstable)this.itemListView.SelectedItem;

    varuri = newUri(item.ImagePath);

    vartile = newSecondaryTile(

                        item.UniqueId, // Tile ID

                        item.Title,  // Tile display name

                        item.Subtitle,

                        item.UniqueId, // Activation argument

                       TileOptions.ShowNameOnLogo, // Tile options

                       uri    // Tile logo URI                    

    );

     
    awaittile.RequestCreateAsync();

            }

                                    

        

               

     

               

     

               

     

     

     

                 

     


                                       

     


                       

     

     

     


                       

     

     


                       

     

     

     

    Wednesday, November 13, 2013 9:47 AM

Answers

  • Hi sarika,

    It is not supported to use a image from web, Secondary Tile logo URI only support "ms-appx:///" or "ms-appdata:///local/". You could download the image and save to your local folder as you mentioned.

    Take a look this link, must help you with saving the data to your local folder: http://www.windowsazure.com/en-us/develop/net/how-to-guides/blob-storage/

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, November 13, 2013 12:05 PM
    Moderator
  • Ah, I'm so sorry for the no responsing, did you solved your problem?

    I'd like to know the width and height of the image, basically tile images must have dimensions less than or equal to 1024x1024 pixels, have a file size of less than or equal to 200 KB. But it seems 60kb should not be any problem.

    Besides, http://code.msdn.microsoft.com/windowsapps/secondary-tiles-sample-edf2a178 will give you the sample for how to set the secondary tile, hope this helps you. You could also read your error message to know why we cannot set the image as the secondary tile.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, November 20, 2013 8:49 AM
    Moderator

All replies

  • Hi sarika,

    It is not supported to use a image from web, Secondary Tile logo URI only support "ms-appx:///" or "ms-appdata:///local/". You could download the image and save to your local folder as you mentioned.

    Take a look this link, must help you with saving the data to your local folder: http://www.windowsazure.com/en-us/develop/net/how-to-guides/blob-storage/

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, November 13, 2013 12:05 PM
    Moderator
  • hello Jameles Hez,

    I have downloaded images from my blob container to my local folder. I am free from the above error but I am not getting image on the secondary tile.

    this is the code I have written inside the click event

    private async void OnPinRecipeButtonClicked(object sender, RoutedEventArgs e)
            {
    
                var item = (Appetizerstable)this.itemListView.SelectedItem;
                item = (await appetizerTable.Where(i => i.UniqueId == item.UniqueId).ToCollectionAsync())[0];
                var blob = App.container.GetBlockBlobReference(item.ImagePath);
                StorageFile file;
                try
                {
                    if (itemListView.SelectedIndex!=-1)
                    {
                        file = await temporaryFolder.CreateFileAsync(item.ImagePath,
                           CreationCollisionOption.ReplaceExisting);
                        using (var fileStream = await file.OpenStreamForWriteAsync())
                        {
                            var outputstream = fileStream.AsOutputStream();
    
                            //Hither
                            InMemoryRandomAccessStream decstream = new InMemoryRandomAccessStream();
                            System.IO.Stream netstream = System.IO.WindowsRuntimeStreamExtensions.AsStreamForRead(decstream);
                            //Hence
                            Stream saveStr = new System.IO.MemoryStream();
                            IOutputStream winStr = System.IO.WindowsRuntimeStreamExtensions.AsOutputStream(saveStr);
                            //  var bufferstream = outputstream.AsStreamForWrite(UInt16.MaxValue);
                            await blob.DownloadToStreamAsync(winStr);
    
                            saveStr.Position = 0;
                            saveStr.CopyTo(fileStream);
    
                            fileStream.Flush();
    
                        }
    
                        // Make sure it's an image file. 
                        var uri = new Uri("ms-appdata:///local/" + file.Path);
    
                        var tile = new SecondaryTile(
                                item.UniqueId,              // Tile ID       
                                item.Title,                 // Tile display name
                                item.Subtitle,
                                item.UniqueId,              // Activation argument
                                TileOptions.ShowNameOnLogo, // Tile options
                                uri                         // Tile logo URI
                            );
    
                        await tile.RequestCreateAsync();
    
                    }
                }
                catch (Exception ex)
                {
                    
                }
               
    
            }

    this is the snippet.
    Thursday, November 14, 2013 12:42 PM
  • Whats the size of your image?

    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, November 14, 2013 1:04 PM
    Moderator
  • 60kb

    Thursday, November 14, 2013 1:17 PM
  • Ah, I'm so sorry for the no responsing, did you solved your problem?

    I'd like to know the width and height of the image, basically tile images must have dimensions less than or equal to 1024x1024 pixels, have a file size of less than or equal to 200 KB. But it seems 60kb should not be any problem.

    Besides, http://code.msdn.microsoft.com/windowsapps/secondary-tiles-sample-edf2a178 will give you the sample for how to set the secondary tile, hope this helps you. You could also read your error message to know why we cannot set the image as the secondary tile.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, November 20, 2013 8:49 AM
    Moderator
  • You should call Dispose() for File Stream before use this file for tile.

    Add:

    fileStream.Dispose();

    After:

    fileStream.Flush();
    Saturday, October 25, 2014 8:06 PM