Joel's SharePoint Architect Blog

SharePoint 2013 Training, Architecture, Administration and Development

Subscribe Subscribe  View Joel Jeffery's profile on LinkedIn
joelblogs.co.uk | joelj.co.uk | joeljeffery.co.uk | jfdiphoenix.co.uk

Posts Tagged ‘Mobile Development’

Windows Phone 7 Ads SDK for Windows Phone 7

Developing for Windows Phone 7? Want to make advertising supported revenue straight from your app? Microsoft has released SDK for that ;) You can download it here: http://go.microsoft.com/fwlink/?LinkId=198440

The SDK takes the form of an assembly that you can simply add a reference to in your project and start using straight away. You can add the reference in Expression Blend 4 or in Visual Studio 2010, and the assembly lives here: C:\Program Files (x86)\Microsoft Advertising SDK for Windows Phone 7\Microsoft.Advertising.Mobile.UI.dll.

In this video, the Windows Phone 7 team walks us through how to set this up and show us what we can do with the SDK.

All I had to do was drop the AdControl from the Toolbox onto my mobile application (started in my previous blog post) and set a couple of properties: AdUnitId and ApplicationId. Both these properties correspond to the account you can set up on the Microsoft Publicity Center site. Simply visit http://pubcenter.microsoft.com and sign up with your Windows Live ID and create an advertising subscription.

Windows Phone 7 Ads Sdk Example

Technorati Tags: Mobile Development, Silverlight, Windows Phone 7

Microsoft has released design guidelines for Windows Phone 7, available here: http://msdn.microsoft.com/en-us/library/ff402535(VS.92).aspx. These are in document form, so if you’d like to write your own Silverlight and XAML application to follow the guidelines, you would have to go through quite a few steps to implement them yourself.

The Expression Blend team took the Windows Phone 7 Guidelines and turned them into some XAML files that you can use right off the bat. Combining different themes (including the iconing dark and light Windows Phone 7 themes), margins and paddings.

Blend also lets you see what your application pages looks like in different orientations (i.e. if you rotate your phone from portrait to landscape.

In this video, the Expression Blend team walks us through what Expression Blend can do for Windows Phone 7 developers using the Windows Phone 7 design templates, available on CodePlex here http://wp7designtemplates.codeplex.com. You’ll also need the Silverlight Toolkit for Windows Phone 7 (here: http://silverlight.codeplex.com/releases/view/52297)

The wp7designtemplates project is available as an Expression Blend solution you can open up and borrow from.

If you’ve got Expression Blend (check your MSDN subcription :) you can try this out yourself. Don’t forget to add references to C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Libraries\Silverlight\Microsoft.Phone.Controls.dll and C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Toolkit\Sep10\Bin\Microsoft.Phone.Controls.Toolkit.dll.

Here’s a simple app that I created :o)

Windows Phone 7 Application Created in Expression Blend 4

(OK – I just had to copy the Grid I wanted to emulate from the CodePlex solution and paste it into one of my own XAML pages).

Technorati Tags: Mobile Development, Silverlight, Windows Phone 7

Damn You, iTunes!

Today was a bad day for my iPhone 3GS running iOS 4.1. A new version of iTunes (10.0.1.22) seems to have caused sync to fail so much I had to restore from an old backup and sync my music library again from scratch. I don’t like losing data, especially when it’s the act of backing up that causes it to become so irretrievably lost.

Being Unfaithful with Windows Phone 7

With that in mind, I’m starting to eye-up the new Windows Phone 7 devices with increasing interest.

In this episode of the series of 7-minute short videos from Microsoft, Nancy Strickland shows us the user experience, design philosophy and application platform hardware and software of the Windows 7 platform.

I’m quite liking the Windows Phone 7 UI, named “Metro”. Apparently so-named because it was inspired by the clear “glanceable” signage you see in underground train stations. I’m guessing they’ve not travelled by tube in London, as I find the Windows Phone 7 UI to be a lot clearer than the Beck’s map.

Windows Phone 7 People Hub vs London Underground Beck's Map

New UI

In a similar vein to iOS and Android, Microsoft Windows Phone 7 as a simple yet powerful finger-driven UI. A friendly Start screen shows Tiles that depict different applications or “hubs”. As developers, we can add to these with our own applications. Out of the box there’s a People hub, a Media hub (which launches the Zune application) and many more.

The application layer is integrated with social networking platforms, and ready for new Web 2.0 services as they come along.

One feature I especially like the look of is the “Panoramic View”; regardless of ability or screen size of the hardware, you get a viewport that can easily be scrolled around the application page. The People hub (pictured above) shows an example of this.

Hardware Platform

Because the Windows Phone 7 OS is licensable software, unlike the closed-shop of iOS from Apple, you could be writing code for a variety of different physical hardware platforms. The Windows Phone 7 platform guarantees a minimum spec though:

  • Video either WGA at 800×480 or HVGA 480×320
  • Capacitive Screen
  • Accelerometer
  • GPS
  • Camera with Shutter Button and Flash
  • Codec Acceleration and DirectX 9 GPU
  • Minimum 256MB RAM, 8MB Flash ROM
  • ARM 7 Cortex/Scorpion CPU or better
  • Start, Search and Back hardware buttons

Developer Platform

As developers we can write code for the Windows Phone 7 OS as Silverlight or XNA applications. These are both managed, .NET runtime environments, and XNA lends itself more readily to the games market.

Windows Phone 7 Application LayersThe diagram to the left shows the logical layering inside Windows Phone 7. The top layer, the Application Runtime can be either Silverlight or XNA.

The Application Model handles management, licensing, isolation and software updates.

The UI Model deals with session management and the page-orientated navigation model. The Cloud Integration layer ties into XBox Live, Bing, LiveID integration, and includes location services and a push notification framework.

The Kernel layer comprises device drivers written mainly by Microsoft to ensure consistency across all vendors’ phones. Lastly we have the Hardware delivered by various vendors to the specifications above.

Windows Phone 7 and SharePoint 2010

But what gives? I’m usually all about SharePoint, and all this phone malarkey has got me posting massively off-topic. In an effort to claw-back some SharePoint-related dignity, let’s try and work through a Windows Phone 7 and SharePoint 2010 Highly Contrived™ example.

So, my Announcement list has the following contents:

Announcement List in SharePoint 2010

Let’s say I wanted to read these from the Windows Phone 7 OS in a Silverlight application. With the current release of Silverlight on the platform, I’d have to allow Basic or Anonymous Authentication to the lists on my site. For my example, I’ve enabled Basic Authentication.

The code below could be used in the event handler for a button click event. It then goes and hits the SharePoint 2010 List Data ReST Service and brings back the ATOM feed of all the list items in the specified list.

Code Snippet
  1. private void createButton_Click(object sender, RoutedEventArgs e)
  2. {
  3.     string url = string.Format("{0}/{1}/_vti_bin/listdata.svc/{2}",
  4.         sitecollectionName.Text, siteName.Text, listName.Text);
  5.     HttpWebRequest webReq = (HttpWebRequest) HttpWebRequest.Create(url);
  6.     webReq.Credentials = new NetworkCredential("USER", "PASSWORD", "DOMAIN");
  7.  
  8.     webReq.BeginGetResponse((result) =>
  9.         {
  10.             HttpWebRequest asyncReq = (HttpWebRequest) result.AsyncState;
  11.  
  12.             try
  13.             {
  14.                 HttpWebResponse res = (HttpWebResponse) asyncReq.EndGetResponse(result);
  15.                 XDocument xml = XDocument.Load(res.GetResponseStream());
  16.  
  17.                 XNamespace ns = "http://www.w3.org/2005/Atom";
  18.                 var items = from item in xml.Root.Elements(ns + "entry")
  19.                             select new { Title = item.Element(ns + "title").Value };
  20.  
  21.                 this.Dispatcher.BeginInvoke(() =>
  22.                 {
  23.                     resultsTextBlock.Text = "";
  24.                     foreach (var item in items)
  25.                         resultsTextBlock.Text += item.Title + "\n";
  26.                 });
  27.             }
  28.             catch (Exception ex)
  29.             {
  30.                 MessageBox.Show(ex.Message);
  31.             }
  32.         }, webReq);
  33. }

 

Joel's SharePoint 2010 List Lister for Windows Phone 7 and SilverlightPutting it All Together

OK, so it’s not the most refined UI in the world, but I knocked this up in only a few minutes using tips from Jan Tielens blog (thanks Jan!) and a little bit of Silverlight knowledge. The result is to the right, and I’m not at all disappointed with how easy this is. A nice-to-have would be if the SharePoint 2010 team could make a version of the SharePoint Silverlight Client Object Model available for Windows 7 Phone, then I wouldn’t need quite so much workaround-code above.

Ease of Use

The key for me was just how easy this whole process was. Once you’ve downloaded the Windows Phone 7 Developer Tools, it’s a simple matter of creating a new Windows Phone Application Silverlight project, dragging some widgets, writing some code and hitting F5 to debug and deploy to the built-in Windows Phone 7 Emulator. Also, C#, Microsoft .NET and Silverlight will be so familiar to a huge audience of would-be Windows Phone 7 developers.

Windows Phone 7 and Visual Studio Debugger

Technorati Tags: Mobile Development, SharePoint, Silverlight, Windows Phone 7

In this video, Nancy Strickland from Microsoft shows us how simple it is to create a functional Windows Phone application using Visual Studio 2010, and even the free Express edition tools at the Windows Phone Developer site

I’ve been a Windows Mobile user since the first SmartPhones came out back in 2001. I upgraded almost yearly, putting up with glitches and slowness, as despite being glitchy and slow, it was consistently the best phone platform for a geek like me.

This all changed in 2008 with the advent of the iPhone 3GS. Suddenly the Jesus Phone seemed to have come of age. All the applications I felt I needed from the SmartPhone and Windows Mobile platform were available (or close approximations) on the iPhone.

Although I seldom wrote code for the Windows Mobile platform, it was always nice to know that I could have if I’d needed to. Maybe using the compact .NET framework.

And this is probably my biggest problem with the Steve Jobs mobile platform: it’s a closed shop. I’ve got to use ObjectiveC or nothing. No support for Flash or Silverlight or the .NET Framework. Or any framework as far as I can make out from the outside, until very very recently. Even the Appple Developer Terms seem to conspire against techies who haven’t yet drunk all the iPhone Kool Aid.

So, as much as I love my iPhone 3GS with iOS 4.x, my next phone will be a Windows 7 Mobile phone.

Free developer tools, and I don’t need a Mac.

Technorati Tags: Mobile Development, Silverlight, Windows Phone 7