Sep 27 2011

Windows Phone 7.5 (Mango) Availability

Category: Joel Ivory Johnson @ 05:46

Mango is starting to roll out! It was several months ago that Microsoft made known that Mango would be available this fall, though when this fall had never been specified. The first day of fall was a few days ago and Microsoft is making good on their promise with Mango rolling out to some devices as early as today. While the Mango BETA had been out for some time there are some questions that are now answered with the final release.

Microsoft is going to start pushing the update to a small number of customers and gradually ramp up the availability. Most customers will have access to Mango by the end of October. Be sure to check the Where's My Update page to know when the Mango deployment begins for your network.

The availability and cost of Internet Connection Sharing will depend on your carrier. It will only be available on new Mango devices. The previously existing devices won't be getting the feature. Keyboards for additional languages may be available on some devices, but the underlying language for a device will still be the same as it was when it was purchased.

Information from the new OS release is still being made known, so I'll be making updates to this page as I encounter them.

Tags: , ,

Aug 27 2011

Slides from What's New in Windows Phone Mango

Category: Joel Ivory Johnson @ 16:36
Last month I did a presentation at the Macon .Net user group on what's new in Windows Phone Mango. I also presented this at the Atlanta Windows Phone developer's group. The slides were uploaded to Skydrive a few days ago but I never did post the link. So here it is. You can download the slides and the example code from here.

Tags: , ,

Aug 7 2011

Windows Phone NTP Client

Category: MobileJoel Ivory Johnson @ 04:17
Download Code (53 KB)

I've got plans for an application in which I need to know with certainty the current time. So I don't want to trust the time as reported by the user's device. Instead I need to retrieve the time from a server. I made a NTP (Network Time Protocol) client for retrieving this information. This is something that couldn't be done on Windows Phone 7 prior to Mango. But with the fall update (Mango) access to sockets is granted.

The use of the client is pretty simple. At minimum one can create the client with the default constructor, subscribe to the ReceivedTime event, and call the RequestTime method to initiate a request. The ReceivedTime event may be called on a thread other than the UI thread so remember to use a dispatcher when making UI updates.

NTP Client

This is an example of a client using the code to display both the system time and the network time.

public partial class MainPage : PhoneApplicationPage
{
    private NtpClient _ntpClient;
    public MainPage()
    {
        InitializeComponent();
        _ntpClient = new NtpClient();
        _ntpClient.TimeReceived += new EventHandler<NtpClient.TimeReceivedEventArgs>(_ntpClient_TimeReceived);
    }

    void _ntpClient_TimeReceived(object sender, NtpClient.TimeReceivedEventArgs e)
    {
        this.Dispatcher.BeginInvoke(() =>
                                        {
                                            txtCurrentTime.Text = e.CurrentTime.ToLongTimeString();
                                            txtSystemTime.Text = DateTime.Now.ToUniversalTime().ToLongTimeString();
                                        });
    }

    private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
    {
            
    }

    private void UpdateTimeButton_Click(object sender, RoutedEventArgs e)
    {
        _ntpClient.RequestTime();
    }
}

Tags: ,

Jun 30 2011

Mango Beta 2 Available for Phones Today!

Category: MobileJoel Ivory Johnson @ 03:48

The Beta 2 Mango Windows Phone Tools are available to developers today! Included with the beta is the ability for developers registered with the AppHub to flash their retail devices.

I know there are some non-developers out there that want to also flash their phones and they may wonder how they get get their phones reflashed with the Mango beta. For the time being they cannot. There is an inherent risk in reflashing the phone; you could end up with a bricked phone if something goes bad. If this happens Microsoft has budgeted to take care of repairing up to one phone per developer. But Microsoft doesn't see this risk as being appropriate for user audiences. [Some] developers on the other hand are willing to risk their device's life and limb to have early access to something new. If you brick your device today Microsoft won't be prepared to act on it for another couple of weeks. That's not the best case scenario. But the alternative was to wait another couple of weeks before releasing the Mango tools. If you don't feel safe walking the tight rope without a safety net then don't re-flash your device yet.

According to the Windows Phone Developer site if you are a registered developer you will receive an e-mail inviting you to participate in early access to Mango.

Tags: , ,

Jun 21 2011

Setting Custom Ringtones from Code [Mango:Beta 1]

Category: MobileJoel Ivory Johnson @ 03:20
Written against pre-release information

One of the new features coming with the next update to Windows Phone 7 is the ability to set custom ring tones. From within code you can make a ring tone available to a user (it's up to the user to accept the ring tone, so user settings won't ever be changed without user permission). I was looking at the new API for doing this, the SaveRingtonTask()

To use the API you first need to get the ringtone of interest into isolated storage. It can be either an MP3 file or a WMA file up to 30 seconds in length. If the file is a part of your application. Just set it's build type to "Resource".

file settings

Getting the file from being packed in the application to isolated storage is a matter of reading from a resource stream and writing to isolated storage.

var
s =
    Application.GetResourceStream(new Uri("/MyApplicationName;component/1up.mp3",
                                            UriKind.Relative));
{
    using (var f = IsolatedStorageFile.GetUserStoreForApplication().CreateFile("1up.mp3"))
    {

        var buffer = new byte[2048];
        int bytesRead = 0;

        do
        {
            bytesRead = s.Stream.Read(buffer, 0, 1024);
            f.Write(buffer, 0, bytesRead);
        } while (bytesRead > 0);

        f.Close();
    }
}

Once the file is in isolated storage you must pass the URL to the SaveRingtoneTask(). URIs to isolated storage are preceded with "isostore:" (there is also an "appdata:" prefix, but we won't be using it here). Give the ringtone a display name and call the show method to present the user with the option to save it. If you don't set the

SaveRingtoneTask srt = new SaveRingtoneTask();
srt.DisplayName = "1up";
srt.IsoStore= new Uri("isostore:/1up.mp3", UriKind.Absolute);
srt.IsShareable = true;
srt.Show();

Tags: , ,