WP7dev

Windows Phone 7 development tips

Category Archives: General

Updating application tile without notifications

Updating the Application Tile is something very appreciated on Windows Phone 7, by users but also by Microsoft. Doing this using notifications can be quite a hassle as you need to write a server side application sending notifications to the phone, but if you need a simple tile update, Microsoft also added the ShellTileSchedule class which provides an easy way to handle this.

Exemple usage, this call is usually made in App.xaml.cs, in App() constructor :


ShellTileSchedule shellTileSchedule = new ShellTileSchedule();

shellTileSchedule.Recurrence = UpdateRecurrence.Interval;

shellTileSchedule.Interval = UpdateInterval.EveryHour;

shellTileSchedule.MaxUpdateCount = 168;

shellTileSchedule.StartTime = DateTime.Now;

shellTileSchedule.RemoteImageUri = new Uri(@”http://website.com/wp7icon.png”);

shellTileSchedule.Start();


Recurrence is used to set update recurrence : either once (Onetime) or at each interval of time (Interval).

Interval : update interval, only four values are supported : EveryHour, EveryDay, EveryWeek, EveryMonth

MaxUpdateCount : optional, you can set a max number of updates, if none is set, the updater will run indefinitely

StartTime : when will the schedule start

RemoteImageUri : image Uri, must be a 173×173 PNG file. Using transparency is allowed, and very advised (Microsoft loves when you use the user accent color)

Detecting connection loss / status on Windows phone 7

Knowing the status of the device connection can be very useful, displaying an error when trying to access something on the internet when the device has no connection is good practice. This is one of the points Microsoft loves to look at, especially when selecting featured applications.

There are two ways to handle this :

First is to use NetworkChange class, for example, in your App.xaml.cs constructor :

App.xaml.cs :


public App()

{

    // Standard App() content

    NetworkChange.NetworkAddressChanged += new  

        NetworkAddressChangedEventHandler(NetworkChange_NetworkAddressChanged);

}

void NetworkChange_NetworkAddressChanged(object sender, EventArgs e)

{

    if (Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType ==

    NetworkInterfaceType.None)

        Deployment.Current.Dispatcher.BeginInvoke(

            () =>

            {

                MessageBox.Show(StringLibrary.General_NetworkError);

            });

}


Or, check directly where you need to use the connection :


NetworkInterfaceType type = NetworkInterface.NetworkInterfaceType;

if (type == NetworkInterfaceType.None)

{

    // Handle error

}


This can also be used to determine what connection type is being used, simply compare NetworkInterface.NetworkInterfaceType to the possible values of NetworkInterfaceType enum.

Be very careful when using this, as when in bad cellular cover, this call can take up to 20s.


Windows Phone 7 publishing Checklist

Submitting an app to the App Hub can be quite long, and you should really prepare this carefully as any mistake can cause you a one week delay for your application publication.

Here is a list of points you should REALLY check or prepare before starting your submission :

  1. Your application must contain contact and legal information.
  2. Your XAP must be built in release, applications built in debug will be rejected.
  3. Prepare the material needed to submit your application:
    • A small mobile app tile icon (required), used in the phone Windows Phone Marketplace, 99 x 99 pixels in size. Must be a PNG without transparency.
    • A large mobile app tile icon (required), used in the phone Windows Phone Marketplace, 173 x 173 pixels in size. Must be a PNG without transparency.
    • A large PC app tile icon (required), used in the phone Windows Phone Marketplace, 200 x 200 pixels in size. Must be a PNG without transparency.
    • Application icon image : 62×62 PNG, can use transparency. Same as image included in your application.
    • Application tile image : 173×173 PNG, can use transparency. Same as image included in your application.
    • Application screenshots : 800×480 PNG, must not use transparency.
    • Application description : Text describing your application, used on marketplace to introduce your application.
    • Featured app description : Very short description used if your application gets featured on the marketplace (quite hard to achieve without having Microsoft contacts, so very optional).
    • Keywords : List of keywords, used on marketplace for search.
    • Define which category & subcategory you want your application to go on the marketplace.
  4. Your XAP must be built in release, applications built in debug will be rejected.
  5. Your application must resume normally on any page.
  6. Your application must display normally whatever theme is used (both Background and Accent color).
  7. Check that for any task making the phone not responsive for more than 3 seconds, a visual indicator such as a loading bar must be used.
  8. The application must render the first screen within 5 seconds after launch.
  9. Within 20 seconds after launch, the application must be responsive to user input.
  10. Any page displaying a popup should close this popup when Back key is pressed.
  11. Your application must not use over 90Mb of memory at any time. Many different memory use trackers can be used to check this, or by yourself using DeviceExtendedProperties.
  12. Be sure that all your text content is localized.

This list is of course not exhaustive, but most application rejection comes from these points.