Saturday, December 29, 2012

How to determine screen resolution on Windows Phone 8

This is a very common scenario most developers stumble across - they are building an app for Windows Phone and have to target all 3 screen resolutions available with Windows Phone 8.

The 3 screen resolutions for your reference are:

WVGA - 480x800 or 800x480 (15:9 ratio)
WXGA - 768x1280 or 1280x768 (15:9 ratio)
720p - 720x1280 or 1280x720 (16:9 ratio)

There may be many scenarios in which you would want to know the screen resolution of the device your app is running on, a popular one being that you want to show higher quality images for higher resolution devices. You can accomplish this very easily by checking for the ScaleFactor as follows:

if(App.Current.Host.Content.ScaleFactor == 100)
{
  // WVGA
}
else if (App.Current.Host.Content.ScaleFactor == 160)
{
  // WXGA
}
else if (App.Current.Host.Content.ScaleFactor == 150)
{
  // 720p
}

And that is all there is to it. Happy Coding!

Until next time,
Paras Wadehra
(Nokia Developer Ambassador)
Twitter: @ParasWadehra

Monday, December 24, 2012

DVLUPer Phone Update

Here's the update you all have been waiting for! In this blog post, I will mention the criteria to qualify to get a Nokia Lumia Windows Phone from me.

* If you write 1 new app for Windows Phone, you can get a brand new Nokia Lumia 800 Windows Phone device.

* If you write 3 new apps for Windows Phone, you can get a brand new Nokia Lumia 900 Windows Phone device.

* If you do not have a developer account for Windows Phone Store already, I can give you a token to sign up which waives your $99 fee for the first year. Contact me if you want one.

* If you write at least 2 new apps for Windows Phone, you will be entered to win 1 of 2 super cool Swiss Army TSA approved backpacks.

You have to be a member of DVLUP to get your new Phone for free. If you still do not have access to DVLUP and need a code to signup, contact me ext-Paras.Wadehra@nokia.com and I will send you a code to signup.

Happy Holidays everyone, and may this festive season your wishes to get a new Nokia Lumia Windows Phone device come true :)

Cheers,
Paras Wadehra
Twitter: @ParasWadehra

Fine print:
* The promotion is limited to developers in US and Canada only.
* Only 1 device per developer will be handed out as part of this promotion.
* Device quantities are limited, they will be handed out in first-come-first-served basis.
* Only quality apps qualify; the final decision of what constitutes a quality app resides with me.
* By participating in any of these promotions, you accept the terms and conditions of any such promotions, and you agree that neither I nor Nokia is responsible in any way for any costs, losses, or harm that you sustain by participating in any such promotion. * You will be solely responsible for taxes, if any, on the items you receive as part of any of these promotions.
* Shipping is free to destinations within continental United States, shipping to other locations will be borne by the receiver.
* New apps means apps first published in the Windows Phone Store after Nov-15.
* You cannot have entered the same app in any other promotion through which you got a Windows Phone device.

Tuesday, December 11, 2012

Nokia's Developer Rewards

I am a Nokia Developer Ambassador, and I have been asked in countless number of emails how to get a device to test apps on, how to get an account for Windows Phone Dev Center, how to get a free phone, and the list goes on...

I will try and answer all these questions (and then some) right here. My goal is to make this program as transparent as I can for everyone involved.

First and foremost, I need all of you to be signed up for Nokia's Premier Developer Rewards program DVLUP.com In case you are one of the few who do not have access yet, contact me directly at ext-Paras.Wadehra@nokia.com to request your access code. Once you sign up (or if you are already signed up), send me your DVLUP username (it is part of the URL that you go to when you log in to DVLUP.

Now I will answer the most requested question of all, How do I get my hands on a Windows Phone device? There are, infact, multiple ways you can get your hands on a Nokia Lumia Windows Phone device. You can actually get multiple devices if you play your cards right.

First is a Trade-Up program, available via DVLUP at http://www.dvlup.com/tradeup It works quite simply -> You first get the value of your existing old phone by entering its make/model on the website. If you like the price shown, you go and buy a brand new Nokia Lumia Windows Phone 8 device (any Lumia model, on any carrier). You print the pre-paid shipping label from the website and ship your old device with the receipt for your purchase and sit back and relax. In a few weeks, you will get your money in form of a Visa Gift Card ready for you to start shopping again, hopefully for accessories for your new device! Using this program, instead of paying the full price for your new phone, you basically pay only the difference between the value of your old phone and the new Nokia Lumia Windows Phone 8 device. And here's the kicker, you can actually make money for purchasing a new phone this way. Let's say you have an old phone that you want to trade-in and you find out it's valued at $250. Now if you buy a new Nokia Lumia Windows Phone 8 device with a new 2-year contract you can get them for as little as $0 depending on the promotion going on. So you just made $250 for buying a new phone - isn't that cool! Oh, and the old phone you trade-in can be any brand, any OS.

Second comes the Device Loaner program available via DVLUP at http://www.dvlup.com/loan This is specially targeted at developers requiring a physical device during development and testing. Once you are signed up for DVLUP, you can request a loaner device for testing. You can check-out a device for up to 2 weeks at a time, and the shipping is paid both-ways by Nokia, so you do not need to spend a penny out of your pocket.

Next up is the awesome DVLUP Rewards Program available at http://www.dvlup.com/rewards - this is what everything ties into. Once you become a member of DVLUP you earn points for doing things that you should normally be doing anyways - creating and updating apps! Once you accumulate enough points, you can get your hands on a brand new Nokia Lumia Windows Phone device for as little as 2500 points (that's only 3 apps under the current Pointstravaganza promotion going on until the end of this month). So let your fingers do the talking and create some awesome apps!

Last, but surely not the least, you can get a Brand New Nokia Lumia Windows Phone device from me just for creating an app. More details on eligibility for this will be in my next blog post.

Most of you would already have Windows Phone Developer accounts (that you got during the special $8 promotion after BUILD). For the unlucky few who did not get in on that deal, I have tokens to the Windows Phone Dev Center which let you register for the 1st year for free (a savings of $99). If you are a student, you get a free Windows Phone Dev Center account as part of DreamSpark. If you do not know about DreamSpark and would like to know more, just leave a comment and I will reply back. If you are a MSDN or Technet subscriber, you also get free Windows Phone Dev Center account as part of your subscription, so log-on today and use the code found in your online subscription center. You need to show me that you are working on an app and are (almost) ready to put it in the store before you get the token.

Aah, and I saved the best for last: I also have a limited number of Nokia Premium Developer Program (NPDP) subscriptions to give away. This gives you access to over $1500 worth of stuff including a free Windows Phone Developer Account ($99), free license to Telerik RadControls for Windows Phone ($99), Buddy.com Cloud APIs ($1200) and 2 Nokia Tech Support Tickets ($198). More details about this program can be found at http://www.developer.nokia.com/Developer_Programs/Premium_program.xhtml

I will also be running contests on Twitter in the future, so follow me @ParasWadehra for more exciting announcements to come.

Until next time,
Paras Wadehra

The fine print:
* The DVLUP program, and any other associated promotions, are currently for developers in US and Canada only. We might expand (no promises) to other countries in the future, keep watching this space for more details.
* Prizes (phones, tokens, and other giveaways) that I directly provide will be given to deserving quality apps only. The final decision of what constitutes a quality app remains with me, and all decisions are final.
* All promotions are a on a first-come-first-served basis, so there are no guarantees you will get these benefits when you build an app.
* By participating in any of these promotions, you accept the terms and conditions of any such promotions, and you agree that neither I nor Nokia is responsible in any way for any costs, losses, or harm that you sustain by participating in any such promotion.
* You will be solely responsible for taxes, if any, on the items you receive as part of any of these promotions.

Saturday, December 8, 2012

Error: DEP0700: Registration of the app failed. An internal error occurred.

So you've started your Windows 8 app development journey. All things are going smooth until one day you hit this error when trying to run/debug your app. The error says "Error: DEP0700: Registration of the app failed. An internal error occurred with error 0x80073D05. See http://go.microsoft.com/fwlink/?LinkId=235160 for help diagnosing app deployment issues. (0x80073cf6)"

This is a very cryptic error and does not give you any info about what the problem actually is. The problem is that Visual Studio is not able to delete the application data in your local packages folder.

Don't worry, the solution is actually very simple. On your Windows 8 machine, go to C:\Users\<UserName>\AppData\Local\Packages\ folder. There you will find a folder that has your application's Package Family Name in it - you just need to delete that folder. The issue is that while your app is in development, it might have a random GUID as its Package Family Name, so the folder will also have that random GUID as its name which makes it hard to know which folder belongs to your app. Again, that is easy to find as well. Right click your project in Visual Studio and click properties. The value you see in the "Package Family Name" field is the name you should look for in the folder. Simply delete it and build your solution again and it will run like a charm.

2 things to keep in mind:
- Close Visual Studio and the simulator before deleting the folder to ensure smooth deletion.
- You may have to use an administrator account to delete that folder.

Until next time,
Paras Wadehra
Twitter: @ParasWadehra