lcj
lcj

Reputation: 1787

error creating tile for microsoft-band

I have been getting errors when trying to create a tile on my band. I can't seem to get through it. Here is the error:

namespace Band_Test_3
{
#if !DISABLE_XAML_GENERATED_MAIN
    public static class Program
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        static void Main(string[] args)
        {
            global::Windows.UI.Xaml.Application.Start((p) => new App());
        }
    }
#endif

    partial class App : global::Windows.UI.Xaml.Application
    {
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
        private bool _contentLoaded;

        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
#if DEBUG && !DISABLE_XAML_GENERATED_BINDING_DEBUG_OUTPUT
            DebugSettings.BindingFailed += (sender, args) =>
            {
                global::System.Diagnostics.Debug.WriteLine(args.Message);
            };
#endif
#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
            UnhandledException += (sender, e) =>
            {
                if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
            };
#endif
        }
    }
}

Using this code. The error is happening on the andClient.TileManager.AddTileAsync(tile) line:

private async void btnCreateTile_Click(object sender, RoutedEventArgs e)
    {
        txbMessage.Text = "";

        // create a new Guid for the tile 
        // create a new tile with a new Guid 
        BandTile tile = new BandTile(tileGuid)
        {
             // enable badging (the count of unread messages)     
             IsBadgingEnabled = true,
             // set the name     
             Name = "Band Test",
             // set the icons     
             SmallIcon = await LoadIcon("ms-appx:///Assets/Certificate-WF Small.png"),
             TileIcon = await LoadIcon("ms-appx:///Assets/Certificate-WF.png")
            };

            await bandClient.TileManager.AddTileAsync(tile);
}

Upvotes: 0

Views: 57

Answers (1)

Mark Thistle
Mark Thistle

Reputation: 1871

The most common errors I have seen for failing to add a tile are:

  • Duplicate GUID for the tile as one already on the band. If you have installed the sample tiles with the sample apps then make sure you are using a GUID that is different from the sample apps. The best thing here is to generate your own GUID for your tile.
  • Maximum number of tiles are installed on the band. To check this, the exception should contain the error message, but you can query the number of tiles installed or you can look at the number installed via the Microsoft Health App in the Manage Tiles view (the number of tiles free is listed towards the top).

If those do now help, then please past in the exception you are getting.

Upvotes: 0

Related Questions