How to create a WP8 wide tile in WP7 XNA...

Created on 31 October 2013 Written by Graham Smith

So, I recently discovered www.DVLUP.com, if you haven't heard of them they reward Windows Phone developers for taking part in various challenges which are aimed at improving the quality of your apps. Completing challenges earns you XP and once you've earned enough XP you can spend it on cool rewards like new devices and marketing campaigns.

However when looking through the challenges I noticed that most of them require your app to have "All 3 Live Tile Sizes", with both of my apps being XNA and targeting the 7.1 OS this presented a problem since the wide tile size isn't natively available. After doing some research I found a couple of different ways to add the wide tile but they required a lot of fiddling like renaming your XAP files to .ZIP and unpacking it to add the image... or another option was to use MangoPollo which is a sort of wrapper for using WP8 functionality in WP7 apps, but again it had problems like forcing the app to restart when adding the tile.

So... in the end i just sort of hacked my own solution using bits of code from both of the previously mentioned solutions, both of my apps have since passed certification and have been accepted for the DVLUP challenges. The only drawback is that the app has to be launched once before the wide tile will be available to the user... anyway heres how I did it:

Both of my Apps are built with XNA4 and im using Visual Studio 2012 with the WP8 SDK targeting 7.1 OS, the wide tile I create is just a static image but you can create a flip tile or whatever without too much fuss.

First thing to do is create the image for your wide tile, the dimensions are 691 × 336 pixels, once you've got your image create a new folder in your game project (I called the folder 'TileImg') then simply add your image to the folder with the following properties:

build action: none
copy to output directory: copy if newer


Now that we have the image for our wide tile we need to alter the WMAppManifest file, add the following code below <Deployment> and above <App> in your Manifest file:

  <AppExtra xmlns="" AppPlatformVersion="8.0">
    <Extra Name="Tiles"/>
</AppExtra>


Then in Game.cs we will need to make several changes, firstly we set our target OS to WP 7.8 because that's the first version to allow wide tiles (7.10.8858 is the official version of WP 7.8). Then we check what version OS the user has, if its greater than the target version then 'IsTargetedVersion' will be true:

       private static Version TargetedVersion = new Version(7, 10, 8858);
        public static bool IsTargetedVersion { get { return Environment.OSVersion.Version >= TargetedVersion; } }


Now we write a new static method, if the user has WP 7.8 or better installed on their phone then a new wide tile is created using the image we added earlier... if the OS is less than 7.8 then it does nothing (you'll also need to add 'using Microsoft.Phone.Shell;' to your using statements:  

        public static void CreateWideTile()
        {
            if (IsTargetedVersion)
            {
                try
                {
                    // Get the new FlipTileData type.
                    Type flipTileDataType = Type.GetType("Microsoft.Phone.Shell.FlipTileData, Microsoft.Phone");
                    // Get the ShellTile type so we can call the new version of "Update" that takes the new Tile templates.

                    Type shellTileType = Type.GetType("Microsoft.Phone.Shell.ShellTile, Microsoft.Phone");
                    // Loop through any existing Tiles that are pinned to Start.

                    foreach (var tileToUpdate in ShellTile.ActiveTiles)
                    {
                        // Get the constructor for the new FlipTileData class and assign it to our variable to hold the
                        Tile properties.

                        var UpdateTileData = flipTileDataType.GetConstructor(new Type[] { }).Invoke(null);
                       
                        // Set the properties. 
                        SetProperty(UpdateTileData, "WideBackgroundImage", new Uri("/TileImg/LargeTile.png",
                        UriKind.Relative));
                       

                        // Invoke the new version of ShellTile.Update.

                        shellTileType.GetMethod("Update").Invoke(tileToUpdate, new Object[] { UpdateTileData });
                        break;
                    }
                }
                catch
                {
                }
            }
        }

        private static void SetProperty(object instance, string name, object value)
        {
            var setMethod = instance.GetType().GetProperty(name).GetSetMethod();
            setMethod.Invoke(instance, new object[] { value });
        }


and finally we have to call the method we just created, we do this as soon as the app is launched:

        protected override void OnActivated(object sender, System.EventArgs args)
        {
            if (SaveComponent.wideTileCreated == false)
            {
                SaveComponent.wideTileCreated = true;
                CreateWideTile();
                SaveComponent.SaveWideTile();
            }
            base.OnActivated(sender, args);
        }

 

You'll notice that I have a flag called SaveComponent.wideTileCreated... once the app has checked the OS version and decided whether the wide tile should be created or not this flag is set to true and saved so that we never check again.

Well that's it... your users now have a nice new Wide Tile they can pin to their start screen and you can enter the DVLUP challenges :D

Comments   

 
0 #268 scr888 link 2018-09-21 14:47
With so many new directories appearing, which are the best
methods to get it sites? You can get by a little help from some of your leading programs that we now on give.
Quote
 
 
0 #267 scr888 link 2018-09-21 14:47
With so many new directories appearing, which are the best
methods to get it sites? You can get by a little help from some of your leading programs that we now on give.
Quote
 
 
0 #266 더킹카지노 2018-09-21 09:56
Its registered location offers lucrative tax incentives,
which allow this provider to deliver attractive odds and regular bonus offers.

Now if you need to win actual money and also you don't want to download you need to first look for land based bingo hall if you don't have any near your house you always have the internet facility to keep up the
bingo gaming experience. Few companies maintain it
well within USD$100 while the limit can vary greatly for
other programs as worst part occurs when you've was able to hit
the bull's eyes of your jackpot that is of a excellent amount but when you are playing
inside the group of "no deposit casino bonus", you'll not be eligible for your entire winning amount nevertheless,
you are able to enjoy only a part of it.
Quote
 
 
0 #265 더킹카지노 2018-09-21 09:55
Its registered location offers lucrative tax incentives,
which allow this provider to deliver attractive odds and regular bonus offers.

Now if you need to win actual money and also you don't want to download you need to first look for land based bingo hall if you don't have any near your house you always have the internet facility to keep up the
bingo gaming experience. Few companies maintain it
well within USD$100 while the limit can vary greatly for
other programs as worst part occurs when you've was able to hit
the bull's eyes of your jackpot that is of a excellent amount but when you are playing
inside the group of "no deposit casino bonus", you'll not be eligible for your entire winning amount nevertheless,
you are able to enjoy only a part of it.
Quote
 
 
0 #264 sky777 2018-09-21 04:34
It may take weeks to months maybe even years or more.
What is often a Google slap, and the easiest method to avoid Google slap?
The other thing that matters a lot is posts.
Quote
 
 
0 #263 sky777 2018-09-21 04:34
It may take weeks to months maybe even years or more.
What is often a Google slap, and the easiest method to avoid Google slap?
The other thing that matters a lot is posts.
Quote
 
 
0 #262 king ocean usa 2018-09-21 04:12
I've been surfing on-line more than three hours these days, but I never found any interesting article like yours.
It's beautiful price enough for me. Personally,
if all webmasters and bloggers made just right content as you probably did, the web
shall be much more helpful than ever before.
Quote
 
 
0 #261 king ocean usa 2018-09-21 04:11
I've been surfing on-line more than three hours these days, but I never found any interesting article like yours.
It's beautiful price enough for me. Personally,
if all webmasters and bloggers made just right content as you probably did, the web
shall be much more helpful than ever before.
Quote
 
 
0 #260 joker123 casino 2018-09-21 03:52
In this way, the No Follow attribute will be removed via comment section.
Comments are incredibly significant to any blog's attaining
your goal. The comment will almost certainly hyperlink
to this webshop.
Quote
 
 
0 #259 lpe88 download 2018-09-20 22:23
You never know when someone will demand information regarding business.
Can be there anything worse in our planet than a child's cry of pain, fear, and stress?

It is during these lean times that every penny
matters.
Quote
 
 
0 #258 lpe88 download 2018-09-20 22:23
You never know when someone will demand information regarding business.
Can be there anything worse in our planet than a child's cry of pain, fear, and stress?

It is during these lean times that every penny
matters.
Quote
 
 
0 #257 lpe88 download ios 2018-09-20 21:28
Showing respect to your friend is necessary as per the relationship advice.
In this way, you ask for you want without criticizing, condemning, or
complaining.
Quote
 
 
0 #256 lucky palace casino 2018-09-20 20:19
You can browse the Internet and more about the same.
Viral marketing spreads statement about you, your company and product without any costs or
low costs only.
Quote
 
 
0 #255 lucky palace casino 2018-09-20 20:19
You can browse the Internet and more about the same.
Viral marketing spreads statement about you, your company and product without any costs or
low costs only.
Quote
 
 
0 #254 3win8 contact 2018-09-20 19:59
Incredible points. Sound arguments. Keep up the good effort.
Quote
 
 
0 #253 playboy casino 2018-09-20 19:53
You will be amazed to are aware of that page rank 5 is way better than page rank 3.

The idea in order to use name a list 'contact-a-web- designer.html' instead of just 'contact.html'.
Quote
 
 
0 #252 playboy casino 2018-09-20 19:52
You will be amazed to are aware of that page rank 5 is way better than page rank 3.

The idea in order to use name a list 'contact-a-web- designer.html' instead of just 'contact.html'.
Quote
 
 
0 #251 d.2 scr888.com 2018-09-20 11:12
One example goes like this: They Laughed After i Sat Down At the Piano, But Not When I Begun Play.
And pictography was the first regarding communicating among early pet
owners. You sense like you're a rainforest.
Quote
 

Add comment


Security code
Refresh

Facebook YouTube

Latest on Twitter

SuperSmithBros @NetflixUK On the Samsung TV app you don't display what language a movie is. Please change it so it displays the la… https://t.co/YtncBZlrar
SuperSmithBros RT @MarcusJLGardner: Graduated with @JamieKKing, @SuperSmithBros and @Polygonical from @MoonshineGS today! Looking forward to our many year…
SuperSmithBros RT @MarcusJLGardner: About 1.5 years ago I applied to my first games job as a QA Tester. The QA lead asked me where I saw myself in 7 years…
SuperSmithBros RT @MoonshineGS: Thanks to everyone who came to see our pitch at Digital Catapult in London! #IndieGameDev #IndieDev #gamedev https://t.co/
SuperSmithBros Thanks to everyone who came to see us at #EGXRezzed. Completely overwhelmed by how positive the reception to the ga… https://t.co/OP24uiKn0D