Getting useful Device Information for Analytics

When I’m looking at the Analytics I’m doing for my Windows Phone apps there are quite a couple of things I’m registering. All anonymous of course, but I’d like to know things about the devices the users of my apps are using. So I went looking for a way to get the same information I already register for my Windows Phone Apps in Google Analytics (see my useful nuget package to get Google Analytics in your Windows Phone apps).

I already have the application version, I explained how to get it in an earlier post. Further more I try to register: Device Manufacturer, Device Type and OS Version. Though the OS Version doesn’t make that much sense I think.

var deviceInfo = new Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation();
var manufacturer = deviceInfo.SystemManufacturer; //Output: Dell Inc.
var productName = deviceInfo.SystemProductName; //Output: Dell System XPS L702X

That was easy, but getting this information through the Exchange Active Sync classes sounds strange, it works and that is what matters. If you know any alternative solutions please add your comments.

I also would like to know the resolution of the user. My current thoughts are that they are probably very high for non-tablets, but the tablets are probably 1366x768. You can get information about the screen-size through Windows.Current.Bounds, however be carefull, the Width is different when the app is snapped or fill mode.

var deviceWidth = Window.Current.Bounds.Width;
var deviceHeigth = Window.Current.Bounds.Height;

Alright that’s very interesting information so far. Maybe this would be useful for a port of the Google Analytics package to support Windows 8 apps.

TechDays 2013 - Make your Windows 8 app stand out

Techdays2013

After attending the Dutch TechDays for quite a couple of years, only last year I wasn’t able to attend. But I’m back this year, not as an attendee but as a speaker. It’s a dream coming true!

The session will be in Dutch, so only the Dutch description makes sense, sorry. You can find my session here.

Make your Windows 8 app stand out

  • Windows 8 heeft een enorm bereik en kan veel voor je app betekenen. Hoe zorg je ervoor dat je app opvalt binnen de zee van applicaties in de Store? Deze sessie gaat in op hoe je optimaal gebruik kunt maken van de mogelijkheden die Windows 8 biedt, zoals:
    - Full, Snap en Fill views
    - Share contract
    - Search contract
    - Play to contract
    - Semantic zoom
    - Tiles en toast
    - Offline mode
    - Touch, Mouse en Keyboard
    Maak ook gebruik van het potentieel van de Windows Store, door middel van reviews, en marketing materiaal en verschillende verdienmodellen zoals trials, in-app purchases of advertenties.

Sharing an Url using NFC in Windows Phone 8

I’m always looking for ways to make use of the new features available in an updated platform. So one of my apps, a Daily offer app (iBood), could have a nice Tap and Share functionality, to share the weblink to the Daily offer.

But how am I going to develop this? I still have no Windows Phone 8 device, even worse, to test this I thought two devices were needed. I’m wrong!

The app can be tested within the Windows Phone emulator which indeed supports NFC. But uh, there’s a need for another device. And there’s a solution for that as well, the Proximity Tapper!

There’s a lot of documentation on the Proximity Tapper website, but basically al I want it to do, is to virtually Tap the emulator.

Now the setup is done, let’s start coding!

Listening for near devices

I explicitly let the user start the Tap and Share functionality through the menu. I’m not sure if it would drain the battery if you start listening for devices upon App start (can anyone confirm?), but I thought it would be good if there was explicit user interaction.

You can just start listening to the DeviceArrived event, like this:

_device = ProximityDevice.GetDefault();
if (_device != null)
{
    _device.DeviceArrived += DeviceArrived;
}

 

You will need to check for a null value, because when there’s no NFC support on the device you’re running on the GetDefault method will return null.

Sending data

So when the DeviceArrived event occurs we immediately start sending data. In my case I want to share the Uri for the daily offer, but it could be anything.

There are two operations that I could use for sending the Uri: PublishUriMessage or PublishBinaryMessage.

The PublishUriMessage simply accepts an Uri instance, though behind the scenes I saw it did send also a uniquer identifier for your application. I think this operation is specially meant to share data to your own application on another device. I just wanted to send the Uri so I went ahead and used the PublishBinaryMessage.

private void DeviceArrived(ProximityDevice sender)
{
    sender.PublishBinaryMessage("WindowsUri", IboodOfTheDay.BuyUri.ToString().ToBuffer());
}

 

An NFC-message consists of a type, in this case it is a WindowsUri, and an IBuffer. So I wrote an extension method that converts a string to an IBuffer.

public static class StringExtensions
{
    public static IBuffer ToBuffer(this string str)
    {
        using (var dw = new DataWriter())
        {
            dw.UnicodeEncoding = UnicodeEncoding.Utf16LE;
            dw.WriteString(str);
            return dw.DetachBuffer();
        }
    }
}

 

So basically that’s all I did to implement NFC in my app. When you run the Proximity Tapper you can see the data coming in, so that should be right. There’s more on NFC, like the NDEF message specifications and a library which implements the specifications.