Saturday, December 25, 2010

WP7 Barcode Scanning using ZXing and Microsoft.Phone.Media.Extended

     When I first saw this blog post from Kevin Marshall it crossed my mind that it could be used for barcode scanning in order to get the same user experience you have on Android and iPhone. I've contacted Kevin to give me some details/source code for the project and a few days ago he sent me his project that is already posted on his blog here. Kevin also thought of the possibility to use it for barcode scanning, but his sample works only with QR codes. Looking at the project I saw that he was using VideoCamera class that has no Focus capability needed to take a "clean" picture of the barcode. The PhotoCamera class, on the other hand, has Focus  implemented so I simply changed the class from VideoCamera to Photocamera. In the Grab method I call the Focus method and then using the AutoFocusCompleted event I decode the barcode. For decoding I use my ZXing port. The results are pretty good as you can see in this video I've uploaded to YouTube. There are some optimizations that can be done like cropping the WritableBitmap at the dimensions of the red rectangle, but even with the full image (640x480) the speed was acceptable on my LG Optimus 7 .
     The source code and the xap of the app (that you can deploy if you have a developer/unlocked phone) are included in my latest release of the ZXing port available on CodePlex. To compile the source you will need to follow the steps Kevin indicated in this post and also you will find some hints/files here. If you start a new project you will also need to add   "ID_CAP_CAMERA" capability to WMAppManifest.xml. This, for the moment, is a hack and I don't think the application will pass Microsoft certification, but you can try. 
  "Reflecting" Microsoft.Phone.Media.Extended I saw no reason why Microsoft won't give access to developers to this assembly (put it in the SDK)! Why limit developers to do great apps when this is the first thing Microsoft needs for the Windows Phone Platform? 
     Special thanks to Kevin for the source code.


NAMASTE

Thursday, December 23, 2010

DropBox library for Windows Phone 7

    So here it is.... I finally published the DropBox client library on CodePlex. It is a fully functional Dropbox client library for Windows Phone 7 and it is the same I've used to build BoxFiles. The first version of BoxFiles received a pretty bad review from http://wmpoweruser.com as it was using only the official API that doesn't have any method for generating links to files (the only way to open a file in Windows Phone 7), but after some searching I've found the API and I think that the current version (1.3) is a pretty good app. I will keep my bad review as they asked 50$ to review the application again. In the following weeks I will publish a new version of the Backup/Restore IsolatedStorage project using Dropbox instead of WCF.
  I've put a lot of work in this library so if you use it please sustain my work by buying the application and please "try" not to publish a similar app to BoxFiles on the Marketplace. 
   I've also published the Sqlite and the ZXing projects on CodePlex so you can grab the source code directly from there.

  I wish you a Merry Christmas!


NAMASTE

Thursday, December 16, 2010

A phone lifetime: an epic battle between Microsoft and OEM

     Looking back at my blog it seems pretty dead, but I intend to catch up as I am on vacation traveling to Brazil and Bolivia so I have some spare time for writing. It's more than a month since I finished the Dropbox client library (that I will soon post on Codeplex) and also Boxfiles for Dropbox which is the application I am trying to publish on the Marketplace. The whole publishing process was (still is as the app is not yet certified) quite an adventure and even with the support of Microsoft Italy, which I thank, it can take up to one month to have a "functional" AppHub account.
    Getting back to the title of the post. I don't know if there is/will be a battle between Microsoft and the hardware OEM, but I really hope so. I am referring to updating your windows phone 7 device. There are already rumors on the web about the "Mango" release and also about Windows Phone 8. From this point of view Apple has a winning strategy. Buying an iPhone gives the owner the certainty that his device will be up-to-date for at least 2 years (2 major releases- the one installed on the phone and the next one). On the other side there is Google and Android where the majority of the OEM choose not to update the phone OS version even if it's a minor release like 2.1 to 2.2 so in less than 6 months you will have an outdated OS. In this moment having an updated iPhone costs less in two years than having an updated Android phone. So what will be Microsoft position for the new Windows Phone? In the previous version of their mobile platform users were usually left behind between OS version updates (or to be more precise left at the OEM mercy), but the releases of updates/new versions were not so frequent which lead to the "death" of the platform on the consumer side and focus on the enterprise side were having and updated device is not so important.  I hope that Microsoft will battle to bring updates to the OEM devices for at least 2 years which is a logical choice as almost every phone operator will give you a device at an affordable price if you sign-up for at least 24 months. That would be a big plus in the battle with Android platform. 
        So who will win? Microsoft or the OEM? Will Microsoft be interested to update the devices for 24 months and loose some earning from OS licenses but give the users more confidence with the platform and compensate with Marketplace earnings?  My feeling is that the devices out now will be obsolete in one year and won't get any updates.  Maybe this is one of the reasons why the sales are not as good as everyone expected them to be: it is the first version, things are still missing and if I buy a phone now it will not be updated to the next version. Will see...


NAMASTE