Windows Phone App Manager

by Nick 17. April 2013 12:53

We’ve been working closely with the local enterprise sales team at Microsoft around the opportunities to use Windows Phone in the enterprise. Personally I think this is where Windows Phone is going to absolutely rule the roost – integration into Exchange, Sharepoint, Office apps, and of course device management through your favourite MDM solution. Something that comes up early in this discussion is “how do I build a company hub for my organisation?” Well we’ve recently released the first version of the Windows Phone App Manager to the Windows 8 store.

 

Windows Phone App Manager app for Windows in the Windows Store

http://apps.microsoft.com/webpdp/app/bcc487fc-d810-4c83-ab17-e58785478a8f

Learn more about Windows Phone App Manager by Built to Roam Pty Ltd and download it from the Windows Store

 

We’ve also been working on a getting started guide – this is particularly important with this release as we’re still working through refining the UX so make it easier for companies to build their company hub.

Tags:

Windows Phone Developer Workshop

by Nick 17. April 2013 12:44
Adelaide Windows Phone 8 Developers Workshop Fri/Sat, May 3rd and 4th

Calling all SA Adelaide based Mobile developers, Microsoft and Nokia are delighted to announce that we’ve have extended the Windows Phone 8 Developer series of workshops to now include Adelaide.

Windows Phone 8 is a huge step forward, not only maintaining compatibility with existing Windows Phone apps, but embraces a number of core Windows 8 technologies, bringing significant performance improvements, support for managed and native C++ development, in app purchase, wallet, NFC, developer access to the Bluetooth and speech APIs, and more. See Windows Phone 8 developer platform highlights.

This two day workshop is scheduled for Friday May 3rd and Saturday May 4th. The first day is a presentation day that will get you up to speed with the Windows Phone 8 developer platform. Day two (Saturday) is a hands on labs day to guide you through the experience of building Windows Phone apps.

REGISTER

Day 1 - Presentation Day

Day 2 - Hands on Labs Day

Tags:

Announcements

Authentication Issues with Windows Azure Mobile Services

by Nick 14. March 2013 17:33

Here are just a couple of gotchas I ran into whilst setting up a Windows Azure Mobile Service to accept login requests from all four providers: Microsoft Account, Facebook, Twitter, Google.

Firstly, grab the site url for your mobile service – On the Dashboard tab the “Mobile Service Url” is on the right under “quick glance”

image

 

Microsoft Account (Instructions)

image

- The name of my application contained words that weren’t allowed. This includes trademarked words such as “Windows Phone”. Unfortunately this meant that when I attempted to set the Redirect URI  and hit Save, nothing appears to happen – the error is not visible as it’s on a different tab. Solution was to change the Application name, then hey presto it works.

 

Google (Instructions)

image

- Make sure you set the type to Web application

- When I created the client id I could only set the site/hostname. You actually need to go back and edit the settings to set the redirect uri to “https://[your mobile service].azure-mobile.net/login/google (note the /login/google at the end)

 

Facebook

image

- Check the website with Facebook login, and specify the site URL

 

Twitter

image

- You need to specify both the website url and the callback uri

 

Hopefully this helps someone get up and running in less time than it took me!

Tags:

Built to Roam Offices and Staff

by Nick 26. February 2013 04:49

It’s been an whirlwind start to the new year for Built to Roam. We’ve just got back from the US and so I thought it’d be a perfect opportunity to share some of the exciting things that are in the pipeline for Built to Roam this year:

New Office

That’s right, we’re stepping out and now have an awesome office space located in North Sydney. This will allow us to be more productive and have a suitable work space for the team as we grow.

New Staff

Yes, you read it right, we’re growing. We’re super happy to have Dave Lasike (and more apps) join us at Built to Roam.  There is so much interest in Windows Phone and Windows 8 that we’re going to need all hands on deck this year to make sure we continue to deliver amazing apps for both platforms.

New Business

In the past building amazing apps typically meant working with an external design team, whether internal to the customer we’re working with or another design studio. This has meant on a number of occasions working with the team at Automatic Studio, lead by the Metro Modern UI wizard, Shane Morris. We’re super proud to announce that we’ve worked together again, this time in the form of a new design and development agency, Pixel and Sons

New Opportunities

If you thought last year was exciting with the release of Windows Phone 8 and Windows 8, you’re not alone. With momentum building for both platforms, this year will see a number of big name brands appear across the whole ecosystem. Our advice is don’t get left behind, make sure you contact us so that we can assist you take advantage of these new platforms and extend the reach of your product set.

Tags:

Announcements

Windows Phone 8 Jumpstart Content and Samples

by Nick 15. January 2013 05:12
  • Videos via Channel 9

Mod 01a: Introducing Windows Phone 8 Development Part 1
Mod 01b: Introducing Windows Phone 8 Development Part 2
Mod 02: Designing Windows Phone 8 Apps
Mod 03: Building Windows Phone 8 Apps
Mod 04: Files and Storage on Windows Phone 8
Mod 05: Windows Phone 8 Application Lifecycle
Mod 06: Background Agents
Mod 07: Tiles and Lock Screen Notifications
Mod 08: Push Notifications
Mod 09: Using Phone Resources in Windows Phone 8
Mod 10: App to App Communication in Windows Phone 8
Mod 11: Network Communication in Windows Phone 8
Mod 12: Proximity Sensors and Bluetooth in Windows Phone 8
Mod 13: Speech Input in Windows Phone 8
Mod 14: Maps and Location in Windows Phone 8
Mod 15: Wallet Support
Mod 16: In-App Purchasing
Mod 17: The Windows Phone Store
Mod 18: Enterprise App Architecture
Mod 19: Windows Phone 8 and Windows 8 Cross Platform Development
Mod 20: Mobile Web

Samples

Windows Phone 8 JumpStart- Contoso Cookbook Step 1, Initial Layout

Windows Phone 8 JumpStart- Contoso Cookbook Step 2, Styles and Alignment

Windows Phone 8 JumpStart- Contoso Cookbook Step 3, Design Time Data

Windows Phone 8 JumpStart- Contoso Cookbook Step 4, Data Binding

Windows Phone 8 JumpStart- Contoso Cookbook Step 5, List Templates

Windows Phone 8 JumpStart- Contoso Cookbook Step 6, Page Navigation

Windows Phone 8 JumpStart- Contoso Cookbook Step 7, Application Bar

Windows Phone 8 JumpStart- Contoso Cookbook Step 8, Landscape Orientation

Windows Phone 8 JumpStart- Contoso Cookbook Step 9, Screen Resolutions

Windows Phone 8 JumpStart- Contoso Cookbook Step 10, Localization

Windows Phone 8 JumpStart- Contoso Cookbook Step 11, Page Transitions

Windows Phone 8 JumpStart- Module 4 Storage Demos

Windows Phone 8 JumpStart- Module 5 Application Lifecycle Demo

Windows Phone 8 JumpStart- Module 6 Background Agents Demo

Windows Phone 8 JumpStart- Module 7 Tiles and Lockscreen Notifications Demos

Windows Phone 8 JumpStart- Module 8 Push Notifications Demos

Windows Phone 8 JumpStart- Module 9 Using Phone Resources Demos

Windows Phone 8 JumpStart- Module 10 App to App Communication

Windows Phone 8 JumpStart- Module 11 Networking Demos

Windows Phone 8 JumpStart- Module 12 NFC and Bluetooth Demos

Windows Phone 8 JumpStart- Module 13 Speech Demos

Windows Phone 8 JumpStart- Module 14 Location and Maps Demos

Windows Phone 8 JumpStart- Module 15 Wallet Demos

Windows Phone 8 JumpStart- Module 16 In-App Purchasing Demo

Windows Phone 8 JumpStart- Module 17 Windows Phone Store Demos

Windows Phone 8 JumpStart- Module 19 Windows Phone 8 & Windows 8 Cross Platform

Windows Phone 8 JumpStart- Managed App Calling Native Library

Windows Phone 8 JumpStart- PhotoSnap

Windows Phone 8 JumpStart- Location Tracker

Tags:

Windows Phone 8 SDK - Deploying Multiple Enterprise Applications

by Nick 3. December 2012 19:12

I’ve already talked about the basics of enterprise application deployment with Windows Phone 8, which you can find in the following two posts.

Windows Phone 8 SDK- Enterprise Application Deployment

Windows Phone 8 SDK- Enterprise Applications (part 2)

In this post we’re going to look at how you can start to manage and deploy multiple enterprise applications. Of course, there will be some organisations who use an MDM provider (for example Silverback) which will facilitate the deployment of applications to specific groups of employees. However, there will be some organisations that elect not to use an MDM, and yet still want to deploy multiple enterprise applications. For this you can use some of the new APIs in Windows Phone 8 to enumerate installed applications and prompt for installation of applications.

Let’s put this in a bit of context – a common starting point is to roll out a company hub style application. By this we mean a simple enterprise application (ie signed by the enterprise for internal distribution) which might list internal news, relevant links and a list of other enterprise applications that are available for installation. The company hub might also require the user to enter credentials in order to personalise these items (eg present only applications that the user should have access to)

image

If the user clicks on these applications there are a number of ways that the company hub can install the selected application. Assuming that the application is stored on a remote server you can simply launch the uri pointing to the xap file.

private void InstallAppClick(object sender, RoutedEventArgs e)
{
    var url = new Uri("http://mydomain.com/myapp.xap");
    Launcher.LaunchUriAsync(url);
}

Whilst this will work, assuming that the enterprise certificate that the application has been signed with is already installed on the device, it doesn’t provide a great experience for the user. Another alternative is to use the AddPackageAsync method on the InstallationManager.

private async void InstallAppClick(object sender, RoutedEventArgs e)
{
    var url = new Uri("http://mydomain.com/myapp.xap");
    var status = InstallationManager.AddPackageAsync("MyApp", url);
    status.Progress += UpdateProgress;
    await status;
}
private void UpdateProgress(IAsyncOperationWithProgress<PackageInstallResult, uint> asyncinfo, uint progressinfo)
{
    // Update UI with progress
}

The return value from the AddPackageAsync method can be used to retrieve installation progress information that can be displayed within the company hub whilst the application is being installed.

Both these alternatives download the xap in clear form from the remote server. Whilst this might be ok if the user is on an intranet, it’s not a great solution if you want to make applications accessible to remote users (which you would hope would be the case since they’re mobile….). In this case you really need to ensure the application is encrypted or protected somehow to prevent the applications from being decompiled. The script for signing the applications does not provide any level of protection – it simply invokes a native compile of the dlls and then signs both dlls and xap. As such you should consider applying your own level of protection, which in turn means we need an alternative method to install the applications via the company hub.

One solution is to package the other applications into the company hub. Each application needs to be created and then signed using the enterprise certificate. They’re then added to the company hub project with the build action property set to Content – this ensures they’re packaged with the company hub. Once the company hub has been installed the user can select one of the applications packaged with the company hub for installation. Since the application isn’t downloaded there is no way to intercept it, so no further protection is required. This method again uses the AddPackageAsync but this time with a uri that points to a file packaged with the company hub (progress reporting has been omitted for brevity). Alternatively you can also use the Launcher.LaunchFileAsync with a reference to the file but again this doesn’t report on the installation progress.

private async void InstallAppClick(object sender, RoutedEventArgs e)
{
    var file = await StorageFile.GetFileFromApplicationUriAsync(new System.Uri("ms-appx:///myapp.xap"));
    var fullSystemPath = new Uri("file://" + file.Path);
    await InstallationManager.AddPackageAsync("MyApp", fullSystemPath);
}

One thing to note here is the slightly unusual path syntax that is required by the AddPackageAsync method. It will not work with either a relative uri or a uri starting with ms-appx or ms-appdata.

The downside of this method is that you need to bundle all the other applications into the company hub, even if they’re not relevant to the current user. A better solution is to download an encrypted application from a remote server, decrypt it locally, and then install the application from isolated storage. In this post we won’t cover the first two steps, as this is up to the organisation as to how they wish to encrypt the application file and distribute the keys to the company hub application so it can decrypt the application file. The last step is actually similar to installing an application that is packaged with the company hub. However, this time the file is stored in isolated storage, which slightly changes the way the file path is constructed (you could also use new Uri(“ms-appdata://local/MyApp.xap”) rather than using the LocalFolder).

private async void InstallAppClick(object sender, RoutedEventArgs e)
{
    var storageFolder = ApplicationData.Current.LocalFolder;
    var file = await storageFolder.GetFileAsync("MyApp.xap");
    var fullSystemPath = new Uri("file://" + file.Path);
    await InstallationManager.AddPackageAsync("MyApp", fullSystemPath);
}

In this post you’ve seen how you can install additional enterprise applications from a company hub. In deciding which method to use you should consider both the sensitivity of the application logic and the risk of data being intercepted.

Tags:

Development

DNS Client for Windows and Windows Phone

by Nick 7. November 2012 11:02

Don’t ask why, but I needed to be able to do a dns record lookup for a srv record from a Windows Phone application. I went looking for a library that could do this and came up with Phone Net Tools (http://phonenettools.codeplex.com/) – this seems a great library but fairly rudimentary support for DNS queries. I also came across a great post by Rob Philpott on CodeProject (http://www.codeproject.com/Articles/12072/C-NET-DNS-query-component) – it’s a bit dated and for legacy technologies (I needed to upgrade everything to even run it!). Whilst this option seemed to be more painful to update the architecture seemed to lead itself to being extended to support srv records. The net effect is there is yet another library on codeplex, this one dedicated to doing DNS lookups from a Windows 8 or Windows Phone application.

At the moment I’ve only got the Windows Phone version uploaded to the Windows and Windows Phone DNS Library. It’s relatively simple to use:

// create a DNS request
var request = new Request();

var domain = "builttoroam.com";
var type = DnsType.MX;
var dnsServer = IPAddress.Parse("203.0.178.191");

// create a question for this domain and DNS CLASS
request.AddQuestion(new Question(domain, type, DnsClass.IN));

// send it to the DNS server and get the response
//Response response =

var resp = await Resolver.Lookup(request, dnsServer);
foreach (var answer in resp.Answers)
{
    Debug.WriteLine("{0}", answer.Record);   
}

Tags: ,

Development | Announcements

Develop for Windows Phone and Windows using Portable Class Library

by Nick 4. November 2012 07:50

In the past I wasn’t a big fan of the Portable Class Library as I felt it imposed more restrictions than necessary and would constrain/frustrate developers more than it would actually solve a problem. However, in recent times a couple of things have happened that have made this whole experience a lot better.

Firstly, we no longer need to drag out VS2010 to do Windows Phone 7 development. The new Windows Phone 8 SDK plugs into VS2012 and allows for both WP7 and WP8 app development. This means that if you’re going to be targeting multiple versions of WP you can do so in the same solution.

Next, the release of Microsoft.Bcl.Async on nuget – ok, you’re probably thinking what’s that? Well a while ago Microsoft published the Async programming CTP. Whilst it had a go-live license and could be used in your Windows Phone 7 project it was a hassle to install in VS2010 (due to a weird set of dependencies which were broken with subsequent updates to VS) and didn’t support VS2012 at all. The Microsoft.Bcl.Async package is the replacement for the Async CTP, allowing you to do asynchronous programming in WP7 apps. Of course, both Win8 and WP8 support async programming out of the box.

Ok, on to using a Portable Class Library. The concept here is that you want to build a single, managed, library that can be referenced by applications targeting different platforms. Let’s walk through a simple example.

We’re going to start by creating three different applications within the sample solution: SimplePCLTestApp.WP7, SimplePCLTestApp.WP8 and SimplePCLTestApp.Win8. As the project names suggest the projects should be targetting WP7, WP8 and Win8 respectively. We’re then going to also create a Portable Class Library called SimplePCL. Note, when you go to create the PCL you’ll see a prompt similar to the following image. This allows you to specify which frameworks your going to be targeting. In this case we’ll take the default options as we’re not going to be building for XBox.

image

The next thing to do is to add the Microsoft.Bcl.Async nuget package into the WP7 and PCL projects. The following image illustrates the package that you’re after.

image

Unfortunately at the moment when you attempt to add this package it won’t give you the option to add it to the PCL. It appears there is some incompatibilities with the current version of the nuget package for Microsoft.Bcl.Async and the PCL. Luckily it’s relatively easy to fix manually:

> Unload the PCL project
> Right-click on the PCL project and select Edit SimplePCL.csproj
> Now, replace the following element

<ItemGroup>
  <!-- A reference to the entire .NET Framework is automatically included -->
</ItemGroup>

With

<ItemGroup>
<Reference Include="Microsoft.Threading.Tasks">
    <HintPath>..\packages\Microsoft.Bcl.Async.1.0.12-beta\lib\sl4-windowsphone71\Microsoft.Threading.Tasks.dll</HintPath>
  </Reference>
  <Reference Include="Microsoft.Threading.Tasks.Extensions">
    <HintPath>..\packages\Microsoft.Bcl.Async.1.0.12-beta\lib\sl4-windowsphone71\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
  </Reference>
  <Reference Include="Microsoft.Threading.Tasks.Extensions.Phone">
    <HintPath>..\packages\Microsoft.Bcl.Async.1.0.12-beta\lib\sl4-windowsphone71\Microsoft.Threading.Tasks.Extensions.Phone.dll</HintPath>
  </Reference>
  <Reference Include="System.Runtime">
    <HintPath>..\packages\Microsoft.Bcl.1.0.11-beta\lib\sl4-windowsphone71\System.Runtime.dll</HintPath>
  </Reference>
  <Reference Include="System.Threading.Tasks">
    <HintPath>..\packages\Microsoft.Bcl.1.0.11-beta\lib\sl4-windowsphone71\System.Threading.Tasks.dll</HintPath>
  </Reference>
</ItemGroup>

> Save, and reload the PCL project

The last preparatory step is to add a reference to the PCL project to each of our applications. This is done as per normal by right-clicking the project, selecting Add Reference, and then selecting the PCL project from the solution node.

We’re now ready to start writing some code. We’ll rename Class1 to ExampleClass and add the following code:

public class ExampleClass:INotifyPropertyChanged {
    private string name;
    public string Name {
        get { return name; }
        set {
            if (Name == value) return;
            name = value;
            OnPropertyChanged();
        }
    }
 
    public event PropertyChangedEventHandler PropertyChanged;
   [NotifyPropertyChangedInvocator]
    protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) {
        PropertyChangedEventHandler handler = PropertyChanged;
        if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
    }

    private readonly ManualResetEvent sleepEvent = new ManualResetEvent(false);
    public async Task UpdateName(string newName)  {
        await Task.Factory.StartNew(() =>
                                        {
                                            // This will sleep waiting for a signal that will never happen!
                                            sleepEvent.WaitOne(1000);

                                       });
    Name = newName;
   }
}

This simple class illustrates a couple of different things:

- The use of INotifyPropertyChanged – almost essential for view models, which you will probably want to share across projects if you’re using MVVM. Note the OnPropertyChanged method uses the CallerMemberName attribute, rather than the property name having to be specified when the method is called.

- The UpdateName method is an asynchronous method which launches a background task using Task.StartNew. This is to simulate some long running task (eg service call, or disk I/O). There is no support for Thread.Sleep in the PCL so we’ve used a workaround which involves waiting for a reset event that will never happen.

- The Name property is updated after the background task has completed. If this method was invoked on the UI thread then it’s safe to update the Name property, since the PropertyChanged event also needs to be invoked on the UI thread to prevent a cross threading violation.

We can then add the following code to the main page of each of our applications:

protected async override void OnNavigatedTo(NavigationEventArgs e)
{
    base.OnNavigatedTo(e);


    var example = new ExampleClass();
    example.PropertyChanged+=ExamplePropertyChanged;
    example.Name = "Initial Name";
    Debug.WriteLine("-------------------------");
    await example.UpdateName("Updated Name");
    Debug.WriteLine("-------------------------");
}

private void ExamplePropertyChanged(object sender, PropertyChangedEventArgs e)
{
    var ex = sender as ExampleClass;
    Debug.WriteLine(ex.Name);
}

Running this, in all cases, should yield the following Debug output (you may see some additional assembly/type loading information as well):

Initial Name
-------------------------
Updated Name
-------------------------

And there you have it. An example of how you can use a Portable Class Library to abstract our your platform independent code.

Tags:

Development

Windows Phone 8 SDK: Accessing Content from an SD Card

by Nick 4. November 2012 04:20

Before you get all excited and worked up about the fact that you can use an SD card with the new Windows Phone SDK there are a couple of limitations that you need to be aware of. Keep in mind that one of the primary scenarios that was being solved was the distribution of apps (errr, did I mention apps…. this is limited to Enterprise apps) and content, rather than being an extension to the device storage.

- You can only access file types that you’ve registered for (this excludes the standard file format – which is a bit nasty if you want your app to say process images or documents supplied on an SD card).

- You can only read from SD card.

Ok, with these limitations in mind, let’s take a shot at reading from an SD card.

First up, we need to get an SD card (oh and a real Windows Phone 8 device to work with) and put some content on it. In this scenario we’re going to use a sqlite database called mydata.sqlite. I simply inserted the Micro SD card, using an SD card adapter, into my laptop and copied across the existing sqlite file. I then inserted the card into my Windows Phone 8 device.

Next, I opened my Windows Phone 8 project and added a couple of nuget packages. These are only required if you’re using sqlite, if you’re using some other file type, you don’t need to worry about these packages.

wp7sqlite – This is a managed implementation of sqlite
sqlite-net – This is a super-easy wrapper that you can use in order to access the content.

image

Unfortunately, whilst these two packages were designed to work together, for some reason the versions that are in nuget are incompatible, requiring some minor modifications to get them to work. Luckily this is mostly a matter of replacing “out” with “ref” in a couple of methods.

The next thing to do is to declare our intent to a) read from the SD card and b) what file types we want to be able to access. Double-click the WMAppManifest.xml to open the designer, switch to the Capabilities tab and check the ID_CAP_REMOVABLE_STORAGE capability.

image

Close the manifest designer, right-click on the WMAppManifest.xml file and select Open With. Select XML (Text) Editor and hit Ok. You need to add a FileTypeAssociation element into the Extensions element. If Extensions doesn’t exist, you may need to create that too – it needs to sit after the Tokens element but before the ScreenResolutions element.

</Tokens>
   <Extensions>
     <FileTypeAssociation Name="sqlite" TaskID="_default" NavUriFragment="fileToken=%s">
       <SupportedFileTypes>
         <FileType ContentType="application/sqlite">.sqlite</FileType>
       </SupportedFileTypes>
     </FileTypeAssociation>
   </Extensions>
   <ScreenResolutions>

Now all that’s left is to write some code in order to access the content from the sd card. If you’re simply going to read from the files you can do so in situ. However, in this case we’re eventually going to want to write to the file, so we’re going to copy it to Isolated Storage first.

// Connect to the current SD card.
var sdCard = (await ExternalStorage.GetExternalStorageDevicesAsync()).FirstOrDefault();

var routeFiles = await sdCard.GetFileAsync("mydata.sqlite");
using (var source = await routeFiles.OpenForReadAsync())
using (
    var target = IsolatedStorageFile.GetUserStoreForApplication()
                                    .OpenFile("writeablecopy.sqlite", FileMode.Create, FileAccess.Write))
{
    await source.CopyToAsync(target);
}

var db = new SQLiteAsyncConnection("writeablecopy.sqlite");
var existing = await db.QueryAsync<MyDataObject>("select * from data");
var data = existing.ToArray();

Don’t forget you’ll want to add appropriate error detection and check that an SD card even exists before you attempt to read from it. For those following the sqlite portion, the MyDataObject class is a relatively simply class, the sqlite-net wrapper handles the conversion between the sqlite data and the .net types:

public class MyDataObject
{
    [PrimaryKey, AutoIncrement]
    public int Id { get; set; }
    public string Name { get; set; }
}

Tags:

Development

Cancel My Newspaper Subscription: Would a Real Journalist Please Stand Up!

by Nick 31. October 2012 09:21

Over the last 48 hours Microsoft has launched Windows Phone 8 (press kit here) and the developer tools, the Windows Phone 8 SDK. Unfortunately there seems to be a spate of bad journalist here in Australia. Rather than actually spending time the platform they insist on quoting other, somewhat biased, journalist. Specifically this piece by Ben Grubb at SMH (http://www.smh.com.au/digital-life/mobiles/windows-phone-8-cant-catch-big-two-20121030-28hed.html). Let’s drill in and see what Ben said quoted:

- First, he states that Microsoft is so far behind Android and iOS that it sees RIM as it’s main rival. This comment is completely out of context and he provides no actual basis. It’s a reality that RIM is the closest in market share, so of course they are the next target in terms of just acquiring market share. This in itself doesn’t mean that Microsoft isn’t looking to capture a much larger market share. If you look at device features, variety, developer platform/tools etc, Microsoft isn’t lagging. In terms of apps, there is a way to go before we get to where Android or iOS is but that’s a result of how long the platform has been around more than anything.

- Next, he says that analysts are saying Microsoft is wrong and has no hope…. Really, again who said this. If this is what you believe, then how about putting your name to this comment.

- It’s great that the only quotes from Microsoft is about how hard it is to compete in a market that’s heavily saturated by the incumbent platforms. Well duh! this isn’t news. How about giving us a run down on all the new features of Windows Phone 8, instead of boring us with the obvious.

- I’m not going to bore you with any more of the quotes, rather than any useful commentary that Ben could have offered if he’d actually bothered to use a Windows Phone 8 device. However I’ll leave you with one last example. Ben quotes Joseph Sweeney of IBRS who has made the comment that he didn’t “really see much new”. Hmmm, and adding a fifth row of icons on the iphone 5 was a ground breaking UI change was it. Here’s a list of some of the changes that are in Windows Phone 8 (I’ll leave it to you to work out whether you think they’re new or not):

* Live Tiles – this in itself is not new. However, apps can now take advantage of three different sizes, the ability to flip and cycle content through the tiles.

* Kid’s corner – an isolated area of the phone where kids can play without parents worrying about their data or wallet being compromised.

* Lock screen – an app can surface content and information directly to the lock screen

* VOIP – the integration of Skype (and other third party VOIP apps) is at a low level, making it ultra efficient (ie won’t drain your battery) and always on (so you can always receive chat and calls)

* Rooms – an area where you can share content with a group of people

* Wallet - I originally had this in here but the other smartphone platforms are all doing their own interpretation of this so it's not really new.

And this is just to cover some of the consumer features that I believe add to an already awesome phone platform. If you want to see an example of a journalist who has actually taken the time with a phone then read the following http://www.informationweek.com/byte/personal-tech/slick-windows-phone-8-an-acquired-taste/240012565

Tags:

Development

Windows Phone 8 SDK: Enterprise Applications (part 2)

by Nick 31. October 2012 07:08

In the previous post we used the XapSignTool directly in order to sign the enterprise application. One of the changes introduced to Windows Phone is the ability for the Windows Phone store to distribute precompiled applications, making them run that much quicker. In order to take advantage of this for your enterprise applications you need to run the MDILXAPCompile tool which ships with the SDK. Luckily, the team have also provided a powershell command making it dead easy to precompile and sign your application in one easy step.

Firstly, you’ll need to run powershell. Depending on how your system is setup you’ll probably want to run it as administrator as you may need to change the execution policy. If you’re familiar with powershell you can probably skip these steps.

Go to C:\Windows\System32\WindowsPowerShell\v1.0, right click on Powershell.exe and select Run as Administrator

If you run into errors running the powershell script, with an error referring to execution policy, you can adjust the policy as follows (warning this will allow any script to run):

Set-ExecutionPolicy -ExecutionPolicy Unrestricted

Change directories to the MDILXAPCompile tools folder within the SDK:

cd ‘C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\MDILXAPCompile\’

Run BuildMDILXap.ps1

.\BuildMDILXap.ps1 –xapfilename 'c:\temp\Provisioning\SimpleCompanyApp.xap' –pfxfilename 'c:\temp\companyappcert.p12' –password mypassword

The output should look like the following

image

Tags:

Development

Windows Phone 8 SDK: Enterprise Application Deployment

by Nick 31. October 2012 06:34

This is a step by step guide to preparing your organisation so that you can sign and deploy enterprise applications.

Certificate Acquisition

Get your Publisher ID/Symantec Id and Approver Email Address

First up you’re going to need your Publisher ID (also referred to as Symantec Id) and Approver Email Address.

These can both be retrieved from your Dev Center account (Must be Company account type)

image

- Type (Blue box): This has to be Company

- Symantec Id (Green box): This is your publisher Id or Symantec Id (as distinct from your Publisher GUID)

- Email (Purple box): This is not necessarily your approver email address

Click Edit (under Contact info) and scroll to bottom of page

clip_image002

- Email address (Blue box): This is the approver email address

Request Certificate

Navigate to https://products.websecurity.symantec.com/orders/enrollment/microsoftCert.do

Enter Publisher ID and Approver Email Address

clip_image004

Complete Billing information

clip_image005

clip_image007

Agree to terms

clip_image009

Confirmation of order completion

clip_image011

Approve your Certificate Request

You’ll need to monitor the approver email address for “Enterprise Code Signing Certificate Order Approval”. If this is someone else in the organisation you must warn them – if they receive this and accidentally click the “I Do Not Approve” option it will result in significant delays.

Click appropriate link to website to review and approve/reject order

clip_image013

Click “I Approve” button

clip_image014

Confirmation of approval

clip_image015

Retrieve your Certificate

You should receive confirmation email that the order has been approved.

clip_image016

Follow the link to retrieve the certificate. This should be done on the same computer and in same browser that the initial request was made.

clip_image018

clip_image020
Click Continue to retrieve the certifcate

Review certificates for the browser. Eg Firefox it’s in Options > Advanced > View Certificates

clip_image022

Click Backup and save the certificate (eg companyappcert.p12 or companyappcert.pfx) complete with private key (you need to set a password)

Open Certificate Manager management console (Start > Run > Certmgr.msc) and confirm that certificate exists and that the full Certification Path exists. This is a common error – only the leaf node is exported. Make sure you have the full path as illustrated in the screenshot below.

clip_image024

Signing and Deploying Applications

Create Application

Create your application as normal. When you want to deploy your application, take a copy of the XAP file that can be located in the \Bin\Release folder of your application.

Sign Application

Open “Developer Command Prompt for VS2012”.

Warning: Make sure you open the correct command prompt as not all of them have the same environment parameters set. This may prevent some of the tools running correctly.

Run the XapSignTool supplying the name of the XAP file as a parameter:

"C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\XapSignTool\XapSignTool.exe" sign /v c:\temp\Provisioning\SimpleCompanyApp.xap

Note:

/v Indicates verbose output – this will be necessary if you have multiple certificates that could be used for signing (which is more than likely)

The next step can be skipped if signing completed correctly. If there are multiple certificates found you’ll need to identify which one you want to use (hence the /v option so that it lists them)

clip_image025

Locate the Symantec Enterprise Mobile CA for Microsoft and copy the SHA1 Hash value (right-click command window and select Mark, select SHA1 value and press Enter to copy value).

Now run XapSignTool again with SHA1 hash value specified

"C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\XapSignTool\XapSignTool.exe" sign /v /sha1 XXXX……hash value….......XXXX c:\temp\Provisioning\SimpleCompanyApp.xap

clip_image027

If successfully run then the original XAP will be replaced by the signed XAP. This file can be hosted on a server for downloading directly to device. Should be protected by credentials and available only over SSL. Whilst it is signed it is not encrypted so can be decompiled.

Warning: The permissions on the file may be changed as part of this process. You may need to reset permissions on the file in order for it to be able to be downloaded to the device.

Generate Application Enrolment Token

From command prompt run AetGenerator (first parameter is the backed up certificate; second parameter is corresponding password).

"c:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\AETGenerator\AetGenerator.exe" companyappcert.p12 mypassword

clip_image028

Deployment of Application Enrolment Token

This can be emailed to the device as an attachment

clip_image030

Click on attachment to download. Once downloaded, click on attachment again to open.

clip_image031

Deployment of Signed Application

Open url of hosted XAP file in Internet Explorer

clip_image033

When prompted confirm installation by clicking Install. Application will then install silently (unlike Store that takes the user to where the application is installed in applications list).

clip_image034clip_image036

Tags:

Development

Windows Phone 8 SDK: Debugging your Application

by Nick 31. October 2012 02:45

Depending on whether your application targets WP7 or WP8 you’ll see different options in the devices dropdown. Since it is possible to run WP7 devices on both WP7 and WP8 devices you’ll see additional options for WP7 targeted applications (right image).

image_thumbimage_thumb1

In the same way that you should always test your application on both the emulator and a real device, for a WP7 application you should test on both the wp7 and wp8 emulators, and ideally both wp7 and wp8 devices. In fact with the new SDK the test matrix just got significantly larger as you need to also test the 720p emulator (I’m less worried about the WXGA emulator since in theory it should just scale up from WVGA – the only thing to watch is that images don’t pixelate).

If you didn’t already realise, the new emulator images are actual hyper-v virtual machines. This means that they will appear in Hyper-V Manager. Although, I wouldn’t recommend attempting to tweak the images via the manager!

image_thumb3

The Additional Tools window includes a Network tab, although in my case it’s a little confusing because there are four adapters. Whilst I haven’t been able to get Fiddler to work with the new emulators it does appear that lower level tools such as Wireshark can be used to monitor traffic – it’s useful to see what the IP address of the emulator is via the Network pane so that you can filter the traffic.

image_thumb5

In the Windows Phone 8 SDK there is another tool that can really assist with debugging applications and their behaviour when interrupted. The Tools menu contains a link to the Simulation Dashboard.

image_thumb8

The Simulation Dashboard (adjusts the currently selected emulator in the device dropdown) allows you to monitor the network speed and signal strength. It also lets you trigger the lock screen and a reminder.

image_thumb10

Being able to trigger a reminder will aid in debugging your application, or game, when it is partially obscured, rather than simply when the user navigates away from your application.

image_thumb7

Tags:

Development

Windows Phone 8: New Project Structure

by Nick 31. October 2012 02:43

In the previous post you would have seen that you can now select with a WP7 or WP8 target when creating a new project with the Windows Phone 8 SDK. With earlier SDK versions the choice of target platform made very little difference to the project structure. Now, there are some substantial differences that you should take note of. The following images illustrate the project structure for Windows Phone 7.1 (left) and Windows Phone 8 (right) projects.

imageimage

Here’s some of my observations:

- There is no splash screen image in the template. Actually WP8 does use the same splashscreen mechanism, requiring the file SplashScreenImage.jpg. You can also provide high resolution versions of the splash screen image which need to be named appropriately (see documentation for details). My guess is that because WP8 application start up so quickly (through a combination of improved runtime and precompilation of assemblies etc), the thinking is that the splash screen is not necessary any more.

- ApplicationIcon has been moved into the Assets folder, recognising that most developers like to organise images etc into a sub folder to make it easier to manage files within a project

- Background image has been replaced by a series of tile images (in the Assets\Tiles folder). WP8 supports small, regular and large tiles, as well as flip and cyclic templates. The series of tiles gives you a starting point to working with the different tile formats.

- AlignmentGrid (located in the Assets folder) is an overlay that you can display on any page to see if your controls/text align correctly. Alignment is an important aspect of fit and finish of an application, and is all too often neglected. The result is an application looks unfinished or off balance. You’ll see in MainPage.xaml that there is a element which you can uncomment in order to display this image. Note: IsHitTestVisible is set to False to ensure it doesn’t affect the way that your application operates. You should also take note of the comment in the XAML which indicates you may need to adjust the Margin depending on whether you have the SystemTray visible or not.

        <!--<Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" />—>

- AppResources/LocalizedStrings. With the new support for right-to-left text it’s become important for developers to know how to globalize/localize their applications. One step in Globalizing your application is moving string literals out into a resource file (ie AppResources.resx). These strings can be referenced via the wrapper class, LocalizedStrings, which is created as a static resource in App.xaml

<Application.Resources>
    <local:LocalizedStrings xmlns:local="clr-namespace:PhoneApp16" x:Key="LocalizedStrings"/>
</Application.Resources>

These strings can then be localized by creating appropriate resource files for each different language you want to support within your application. Depending on the language specified on the user’s Windows Phone, the most appropriate language will be used within the application.

One last observation is that the list of References has changed. Microsoft has recognised that developers shouldn’t have to add/remove assemblies that are part of the .NET Framework. As such, instead of seeing individual assemblies, developers now see just the frameworks that are references (see below image).

image

Tags:

Development

Windows Phone 8 SDK: Creating a New Application

by Nick 31. October 2012 02:42

It goes without saying that the starting point for any project is going to be the new project dialog. We are of course talking about Visual Studio 2012, where you’ll find all the Windows Phone 8 SDK goodness. What some people don’t realise is that you can do the same thing (ie create projects) in Blend. However, I find Blend to be obnoxious when it comes to file management and dealing with project structure. This is the one reason why I always start in Visual Studio – get your project/solution structure right, and then invite the designers into the room.

image_thumb1

New Project Dialog

The project templates in New Project Dialog, as you can see, haven’t changed much with the exception that in addition to a XAML/XNA template, there is also a XAML/Direct3D. With Windows Phone 8 we can now write native code to be part, or all, of our application or game.

image_thumb4

Native Code Project Templates

There are also a number of native project templates which you can use to create all or part of your project.

image_thumb6

Choosing the Target Platform

Most of the managed project templates you’ll be prompted to choose which platform you wish to target. Clearly if you’re making use of native code, you’ll only be able to target Windows Phone 8. One thing to note is that if you target Windows Phone 7.1 your application will run on both WP7 and WP8 devices but of course, you won’t be able to access any of the new functionality.

Tags:

Development

Why the iPhone 5 is a Fail

by Nick 27. October 2012 17:14

When the iPhone 5 came out I thought it about time that I experience how the other side lives; you know the side that seem to drool at any thing white and shiny (also known as ilunatics for participating in iqueues).  Most people who know me know how Microsoft-centric my world is but from time to time I do step out and try to familiarise myself with other platforms. With this in mind when I renewed my phone contract I signed up for an iphone 5, which of course came with a replacement nano-sim.

Ok, so here are just a few of my observations:

- Why a nano-sim? I don’t believe the space saving warrants being different from every other phone on the market. I had to spend two extra agonising days with the iphone, just because I couldn’t find a converter to go back up to a micro-sim.

- Why the new socket? Ok, not being in the land of white and shiny, I don’t really care that it’s changed. What I care about is the Apple have again defied the industry and gone with their own proprietary connector. Instead of using one of hundreds of micro-usb cables I have floating around, I have to use the white cable that came with the device, and I have to keep it in a locked box for fear on our cats chewing on them (they seem to hate Apple products and will chew on them at any opportunity).

- The apps rock! The one thing I have to say about the iphone is that the quality and depth of apps available is second to none. Whilst some haven’t been adapted to the new height of the iphone 5 they’re still of exceptional quality.

- The core platform does NOT rock When the iphone first came out the interface was revolutionary in the way that users interacted with the device. My comment, even back when the iphone 3 came out is that Apple had failed to innovate with the iphone; evolve, absolutely, innovate, not so. With iphone 4 and now 5 there is nothing that I’ve seen in the core platform that says to me “I’ve got to have that” If you compare the numerous Android devices on the market, the iphone 5 really just doesn’t lead the pack, in fact from a UX perspective it trails a poor third to both Android and Windows Phone.

- The Ads, Really??? I don’t know whether you’ve seen the new TV ads that talk about how they’ve optimised the height of the new iphone 5. I must admit I had to double-take as I thought it was a spoof initially, now I just feel embarrassed for Apple. They must really be scared if they’ve stooped so low. Don’t get me started on the ear buds (as if no other headphone manufacture has shaped their earbuds before, in fact shame on Apple for not having done this sooner) or the dancing ipods.

Lastly, before I sign off I want to make an interesting observation about the timing of the ipad mini v’s Windows 8. As you’re probably aware Apple made their announcement the day prior to Microsoft’s mega Windows 8 launch. It strikes me that Apple might have got this the wrong way round – by putting it the day before, it was almost forgotten the next day when Microsoft went to press. Had they done it the day after, wouldn’t they have taken the focus back from Microsoft back onto Apple. I’m no marketer but would have loved to have heard the logic about the timing of these events.

Don’t forget that next week is BUILD

Tags:

Development

Windows 8 Launch

by Nick 26. October 2012 19:40

For those not living under a rock you’ll have noticed that Windows 8 has been launched. Over the past month or so I’ve been involved in a couple of Windows 8 projects. All three projects made it into the store just in time for the launch events.

image_thumb[1]

With this interlude over, we’ll be back to more frequent Windows Phone updates….

Tags:

Development

Long time no post

by Nick 13. August 2012 18:00

I must apologise for the long absence of posts on this blog. This is due to two factors: the first due to the large workload over the last six months. The second is that I've been posting more frequently over at the Mobile Corner on the Visual Studio Magazine web site. A full list of my posts are linked to from the published link.

If you're in Australia over the coming months, don't forget to come out to TechEd and check out all things Windows Phone and its big brother Windows 8.

Tags:

Development

Limitations of the WebView in Windows 8 Metro Apps

by Nick 21. April 2012 18:13

Having worked quite intimately with the WebBrowser control in Windows Phone I was a little flawed by how immature and annoying the WebView for Windows 8 metro app is. As noted by Brent Schooley in his post on Metro WebView Source and HTML workarounds you can work around some of the limitations such as the missing SaveToString method. One of the features of the WebBrowser control that I quite often use is the series of events that are raised around navigating to pages within the control. Unlike the WebBrowser, the WebView is missing events such as Navigating, Navigated and NavigationFailed, and has only the LoadCompleted event. I figured that I should be able to detect when the current page is changing, and thus raise a Navigating event. Turns out that it is possible with a combination of InvokeScript (to invoke some javascript within the page) and window.external.notify (to raise an event when the page in the browser is changing). The following WebViewWrapper class exposes a Navigating event which you can wire an event handler to in order to detect when the browser is being navigated away from the current page (unfortunately there doesn’t seem to be a way to extract the target url, nor to be able to cancel the navigation, unlike the real Navigating event that the WebBrowser control has). I’ve also included a SaveAsString method which wraps the code Brent had in his post.

public class WebViewWrapper
{
    // Maintain a reference to the WebView control so that
    // we can invoke javascript
    public WebView WebView { get; private set; }

    public WebViewWrapper(WebView webView)
    {
        WebView = webView;
    }

    // The Navigating event is a custom event, allowing us to hook/unhook
    // from the ScriptNotify and LoadCompleted events. To invoke this
    // event, we actually invoke the internalNavigating event.
    private event EventHandler<NavigatingEventArgs> internalNavigating;
    public event EventHandler<NavigatingEventArgs> Navigating
    {
        add
        {
            WebView.ScriptNotify+=NavigatingScriptNotify;
            WebView.LoadCompleted+=WireUpNavigating;
            internalNavigating += value;
        }
        remove
        {
            WebView.ScriptNotify -= NavigatingScriptNotify;
            WebView.LoadCompleted-=WireUpNavigating;
            internalNavigating -= value;
        }
    }

    // When each page loads, run a javascript function which wires up
    // an event handler to the onbeforeunload event on the window.  This
    // event is raised when the window is about to unload the current page
    // In the event handler we call window.external.notify in order to raise
    // the ScriptNotify event on the WebView. The javascript function also
    // returns the current document location. This is used to update the
    // AllowedScriptNotifyUris property on the WebView in order to permit
    // the current document to call window.external.notify (remembering
    // that even though we injected the javascript, it’s being invoked in the
    // context of the current document.
    private void WireUpNavigating(object sender, NavigationEventArgs e)
    {
        var unloadFunc = "(function(){" +
                            " function navigating(){" +
                            "  window.external.notify('%%' + location.href);" +
                            "} " +
                            "window.onbeforeunload=navigating;" +
                            "return location.href;" +
                            "})();";
        var host = WebView.InvokeScript("eval", new[] { unloadFunc });
        WebView.AllowedScriptNotifyUris = new[] { new Uri(host) };
    }

   // Check to see if the ScriptNotify was raised by the javascript we
   // injected (ie does it start with %%), and then raise the Navigating
   // event.
   private void NavigatingScriptNotify(object sender, NotifyEventArgs e)
    {
        if (internalNavigating == null) return;
        if(!string.IsNullOrWhiteSpace(e.Value))
        {
            if(e.Value.StartsWith("%%"))
            {
                internalNavigating(this, new NavigatingEventArgs() {LeavingUri = new Uri(e.Value.Trim('%'))});
            }
        }
    }

    public string SaveToString()
    {
        try
        {
            var retrieveHtml = "document.documentElement.outerHTML;";
            var html = WebView.InvokeScript("eval", new[] { retrieveHtml });
            return html;
        }
        catch
        {
            return null;
        }
    }
}

public class NavigatingEventArgs:EventArgs
{
    public Uri LeavingUri { get; set; }
}

Actually making use of the WebViewWrapper class is as simple as creating an instance and then wiring up an event handler.

public BlankPage()
{
    this.InitializeComponent(); 

    var wrapper = new WebViewWrapper(MyWebView);
    wrapper.Navigating += WrapperNavigating;
}

void WrapperNavigating(object sender, NavigatingEventArgs e)
{
    Debug.WriteLine(e.LeavingUri);
    Debug.WriteLine((sender as WebViewWrapper).SaveToString());
}

Tags:

Development | Development

Timeout of HttpWebrequest and WCF service calls on Windows Phone

by Nick 9. April 2012 15:44

Firstly, I’m ashamed that the Windows Phone team didn’t do a better job of providing an ability to set a Timeout for either HttpWebRequest, WebClient and WCF service requests. You might be thinking…. but it’s Silverlight and everything’s Async all the time. Well you’d be correct in that thought process but just because something is asynchronous, doesn’t mean that the user isn’t sitting there waiting for something to complete.

For example say you have a simple form that the user has to fill in before they can proceed (eg “create user” form). Clearly if they are on a good network then you’d hope that the service request returns almost instantaneously and the user is cleared to proceed within the app. However, if for whatever reason the request takes longer than expected (slow network, busy server etc) you don’t want the user to sit there indefinitely. After about 10-20 seconds they’re going to get frustrated and probably close and then uninstall your application. Simple solution is to put a Timeout on your service calls so that you can notify that there is something wrong and that they should try again later or check their connection.

Simple you say…. not so. There is no Timeout property that you can set on either HttpWebRequest, WebClient or on the WCF proxy classes that are generated by Add Service Reference. Luckily there are a number of good posts already on the web that cover the basics of implementing a timeout for doing HttpWebRequests (for example this post on stackoverflow).

What isn’t as well covered is how to implement a Timeout for WCF service calls. The challenge with implementing a Timeout property is trying to wrap the asynchronous pattern that the WCF proxy generates. For example if you have a service method called “Authenticate” the proxy will have a AuthenticateAsync method and an AuthenticateCompleted event. Attempting to use these to implement a Timeout is going to result in some very messy code. The other thing to consider is that .NET is evolving towards having true asynchronous support in the form of asynchronous method support. This is built in for WinRT and can be incorporated into your Windows Phone applications today using the Async CTP.

In this post we’re going to use the Async CTP to do two things. Firstly, wrap the fictitious Authenticate service call into an asynchronous operation and secondly give it Timeout support, again through the use of an async operation. The code is implemented as a partial class to the proxy class that is generated when you do  “Add Service Reference”. It does required you to implement the first method for each service method that you want to wrap.

namespace PhoneApp30.MyServices
{
    public partial class SimpleServiceClient    {
        public async Task<string> Authenticate(string username, string password, object state = null)
        {
            return await Async( (cb,st)=>
                Channel.BeginAuthenticate(username,password,cb,st),
                Channel.EndAuthenticate, state);
        }
        private async Task<TResult> Async<TResult>(
            Func<AsyncCallback, object, IAsyncResult> beginMethod,
            Func<IAsyncResult, TResult> endMethod,
            object state)
        {
         
            var method = Task<TResult>.Factory.FromAsync(
                beginMethod,
                endMethod, state);
            return await InvokeWithTimeout(method);
        }
        public async Task<TResult> InvokeWithTimeout<TResult>(Task<TResult> method)
        {
            var newTask = Task.Factory.StartNew(() =>
            {
                if (!method.Wait(30*1000))
                {
                    Abort();
                    throw new TimeoutException();
                }
                return method.Result;
            });
            return await newTask;
        }
    }
}

Now we can call the Authenticate method from our code in a relatively synchronous manner. Note the difference is that this won’t block the UI as it is an asynchronous operation.

async void MainPage_Loaded(object sender, RoutedEventArgs e)
{
    try{
    var client = new SimpleServiceClient();
    var result = await client.Authenticate();
    Console.WriteLine(result);
    }
    catch(TimeoutException ex){
        // Handle timeout 
    }
}

Tags:

Development

Powered by BlogEngine.NET 2.0.0.36

Automotive Theme by Car Leasing Experts

 

Page List