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

Wednesday, November 14, 2012

Nokia DVLUP program

Let me formally introduce myself first for new followers. My name is Paras Wadehra and I am a Nokia Developer Ambassador. Now you may be saying to yourself "Wait a minute, I have no idea what that means!" Hold on to your reins and I will explain it all to you.

Well, in simple terms it means that I have phones to give to you - yes, you! If you write an app for Windows Phone and put it in the Windows Phone store, I can give you a phone. I hear people saying "But I do not want to pay $99 a year for the Windows Phone store developer account." Well, I have a solution for that as well. If you are a new developer who does not have a Windows Phone store account yet, I can provide you with a token so that you can register for first year for FREE! Now, how cool is that!

But wait, there's more! Nokia recently announced their new developer program called DVLUP (pronounced just like develop). If you register at http://www.dvlup.com you can get points for doing things that you already might be doing, things like creating an app, updating your existing apps, helping other developers in the forums, etc. With these points, you can get Big Rewards. What rewards, you ask? Rewards like brand new XBOX 360 with Kinect, Nokia Lumia phone, JBL Powerup Portable Wireless Charging Speaker and more. Currently this program is in private beta so you will need a code to sign up. Follow and contact me on twitter (@ParasWadehra) if you need a code and I will happily provide you one. This will open up a whole new box of possibilities for you! Oh, and you can also get loaner devices from there to test your apps while in development.

So jump right in, write new apps for Windows Phone and bask in the glory and rewards you get!

Contact me on twitter @ParasWadehra or send me an email ext-Paras.Wadehra@nokia.com to get in on the goodness!

--
Paras Wadehra

Tuesday, November 13, 2012

Mobile App Hackathon

What do app developers from around the world have in common? They all like to be rewarded for their efforts!

And you can get just that by attending the AT&T Mobile App Hackathon in Las Vegas this coming weekend. All you need to bring is your laptop and the will to code. You will get access to AT&T APIs and enough caffeine to keep you coding all night!

Register at http://mobileappvegas-paras.eventbrite.com

Oh, and there will be enough delicious food to feed an army, so come hungry!

You will have the chance to win some exciting prizes like $500 cash gift cards and premium service to GitHub, among others.

Before you forget, register at http://mobileappvegas-paras.eventbrite.com

Follow me on twitter for more exciting updates about this and future events.

--
Paras Wadehra
Twitter: @ParasWadehra

Sunday, November 4, 2012

Error connecting to undo manager of source file

If you get an error like “Error connecting to undo manager of source file ‘Default.aspx.designer.cs’” in Visual Studio, then simply edit both the .aspx and .cs files and recompile.

You don’t have to change the files, you can just add and delete a character – enough to set the “changed” flag, and that should solve your problem.

Hope it helps!


Paras Wadehra
Twitter: @ParasWadehra
 

Monday, October 1, 2012

Book Review: Microsoft Silverlight 4 Development (70-506) Certification Guide

I have been reading the “MCTS: Microsoft Silverlight 4 Development (70-506) Certification Guide” for the last few weeks now and can speak to its simple approach towards getting you ready for the actual certification exam.

The book contains various topics from the introduction to XAML, to creating custom user controls and even more advanced topics like animations via storyboards. It also touches the out-of-browser experience that was introduced with Silverlight 3 and helps you create such applications. The book also includes sample test questions to help you prepare for the actual exam.

Overall, I have enjoyed reading the book and believe it has increased my knowledge of Silverlight. I have built several Windows Phone and Windows 8 apps which make use of Silverlight/XAML and this book has definitely sharpened my skills in some areas.

The book can be downloaded from Packt Publishing's website at http://www.packtpub.com/mcts-microsoft-silverlight-4-development-70-506-certification-guide/book

--
Paras Wadehra
Twitter: @ParasWadehra

Sunday, September 23, 2012

Error: DEP0600: The following unexpected error occurred during deployment: Could not find a part of the path

If you receive an error like "Error: DEP0600: The following unexpected error occurred during deployment: Could not find a part of the path 'C:\Code\UnitConverter\bin\Debug\AppxManifest.xml'" during development/deployment of your Windows 8 App, you are not alone.

This simply means you copied the code for your app from one folder to another and are trying to run/deploy it from the new location now! Don't worry, the solution is very simple - just do a "clean solution" and then "rebuild solution" and you are on your way to run the app successfully.

Told you, it was simple :)

For your information, the full stack trace for the error would probably look like following:

Error : DEP0600 : The following unexpected error occurred during deployment: Could not find a part of the path 'C:\Code\UnitConverter\bin\Debug\AppxManifest.xml'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Microsoft.VisualStudio.ImmersiveProjectServices.Shared.DataFilesShim.LoadManifest (String path, String& checksum)
   at Microsoft.VisualStudio.ImmersiveProjectServices.Shared.AppxManifest..ctor (String manifestFile, LogHelper logger)
   at Microsoft.VisualStudio.ImmersiveProjectServices.Shared.RegisterAppxLayout.Start (Boolean forceNewLayout, Boolean forceRegistration, NetworkLoopbackState desiredNetworkLoopbackState, Boolean refreshLayoutOnly, String& packageMoniker, String& firstUserAppID, Exception& deployException)

And here is a link to my app, UnitConverter for Windows 8, for all of you to download and play with - http://apps.microsoft.com/webpdp/app/unitconverter/15f6278c-3c3b-492e-a82f-691ad1b45f5b

As always, feel free to ask me any questions about your Windows Phone and Windows 8 development dilemmas.

Cheers,
Paras Wadehra
Twitter: @ParasWadehra

Wednesday, June 13, 2012

Async CTP v3 installation issues

If you tried installing Async CTP v3 with your VS 2010 installation and are having problems, then this might be of help to you.

There are some updates that you might have received via Windows Update that interfere with the successful installation of Async CTP v3. Three in particular, KB2635973, KB2615527 and KB2645410, are known to be incompatible with Async CTP v3.

If you have any of these updates on your system, then please remove these before trying to install Async CTP v3. Once Async CTP v3 is successfully installed you can install these and other newer updates.

To read more about this issue, click here.

Cheers,
Paras

Tuesday, May 29, 2012

Error : DEP0600 : The following unexpected error occurred during deployment: Illegal characters in path.

During the deployment of your Windows 8 Metro application, you may encounter the following error: Error : DEP0600 : The following unexpected error occurred during deployment: Illegal characters in path.


This may happen if you moved your project to a new location after its first deployment and you are trying to redeploy the application. There are 2 ways to resolve this error, both of which I mention below.

FIRST SOLUTION

Uninstall the version of the application installed from another location. To do this, on the home/start screen right click on your app's icon and then click uninstall in the menu bar at the bottom. Once uninstalled, the error in Visual Studio should disappear.

SECOND SOLUTION

Create a new GUID and copy it. Now open the Package.appxmanifest file and replace the package name with the new GUID. This should fix the deployment issue.

If you do not know how to generate a new GUID, you can alternatively create a new app and copy its package name into your app to resolve this issue.

Happy Coding,
Paras Wadehra

Thursday, January 12, 2012


BZ Media is organizing the first ever Windows Phone Developer Conference to be held from October 22-24, 2012 in San Francisco Bay Area in California.

You can find the announcement at http://bzmedia.com/BZ_Media_Announces_First_Windows_Phone_Developer_Conference/10014 and more details about the conference at http://www.wpdevcon.net/

WPDevCon will have 3 tracks:

  • WP Essentials – for all Windows Phone developers, and cover all programming topics.
  • WP Enterprise – for  building and managing apps for employees, business customers and partners.
  • WP Marketing – business-oriented sessions that cover Windows Phone marketplace, app marketing and distribution.