What’s Next For Phone Developer?

If you’re a Windows Phone Developer, by now you might have heard about OR rather, upgraded your phone to Windows Phone 8.1. Microsoft, recently released Windows Phone 8.1 (Codenamed Blue) for Developers. To get these bits on your device, you need to a registered Windows Phone developer and need to install Preview For Developers app on your phone. You can find more information here Once you upgrade the phone, you’ll find lots of resources online to get to know what’s new in Windows Phone 8.1.

Now, as a developer, you’ve the phone to test and build apps for. However, to build applications for this latest version of Windows Phone, you need Visual Studio 2013 Update 2 (currently in RC). You can get these bits from here

As a developer, first, you need to unlock your phone. If you remember, there used to be Phone Registration Tool, which gets installed when you install Windows Phone SDK. Now, this tool is integrated into Visual Studio and you can launch it from Tools menu

Untitled

When you connect your phone, you can easily developer unlock it to test your applications on it.

image

Similarly, you can use, App Deployment tool to deploy XAP (or now Appx) to Phone.

image

New addition to these tools is ‘Windows Phone Power Tools’. And these tools does lot of work for you, right from verifying the app, checking the performance and what not.

image

Even thought, this release is titled as Windows Phone 8.1, there are so many features that *I* will personally call it Windows Phone 9 Smile

To give you idea about what’s new in this platform and how you can develop apps for it, Microsoft is hosting online events. These are all free online events. So, register now and get the benefits from it.

Building Apps for Windows Phone 8.1 Jump Start (April 29- May 1)
//Learn – Global Community Webcast (April 24)

Happy Coding,

Mayur Tendulkar

One Code To Rule Them All, but Why?

Windows: runs on more than 90% desktops, laptops, netbooks and nowadays it runs on kiosks, smart devices, phones and these days gaming console. However, developers always faced challenge to target all these devices and deliver ONE app, which can run on all these devices. There were differences in APIs, kernel, core services and what not.

When .NET was released, Microsoft tried to solve this problem by introducing .NET Framework on desktop and .NET Compact Framework – a subset of full .NET Framework *modified* for smart devices. Then, there was yet another .NET Framework for yet another class of devices called .NET Micro-Framework. So, developers had three different .NET Frameworks to target different class of devices, yet someone can’t just copy/paste code from one device app to another. Libraries compiled for one device may not work on another (e.g. app compiled for Windows Mobile *may* fail if ran on desktop – as both used to be PEs). But, for someone like me, it was a good start. I could write apps for mobile phones or desktop using the same language that I know i.e. C# or VB.NET.

Later, Microsoft introduced a very nice concept of Portable Class Libraries, which allowed developers to share code between various platforms.

image 

The limitation was, PCLs are binaries which give you ‘least common denominator’ of APIs available across platforms you selected. So, if you select .NET Framework and Windows 8, APIs which common to these two platform will be selected. And, if you wanted to do maximum code-reuse, your best bet is to follow MVVM like patterns, put models/view models in PCL and create app for views. So, the project structure will look like:

image

PCLs solve some of the issues in best possible way. But when it comes to Windows & Windows Phone, there are lot of similarities like UI, API set, programming model. Here we need some solution which can give maximum code reuse and go beyond PCLs.

Welcome to Universal Apps

image

Universal Apps allows you to build app with maximum code sharing which can work on Windows and Windows Phone (and Xbox in future). When you create Universal App, template creates 3 projects for you as shown below:

image

Now, you may say that it looks pretty similar to above mentioned solution which use PCLs.  Yes, it looks same, but there are internal differences:

When you create Universal App, you can share UI, Media, Code, XAML, etc.. using Shared Project. Now, Shared project allow you to share *code* between projects, whereas PCL allow you to share *binary* between projects. That also means, you can’t use #if.. #then compiler switches in PCLs and can’t write (or rather get benefit from) platform specific code. So, it also means that, when you build the project, you don’t get *.Shared.dll or something and it is not *referenced*, rather during build the code will be automatically included from shared project into individual projects. You can spot the difference in icon here.

image

With Universal App, you can share UI as well. In next screenshot you can see that there is almost no difference in Windows page and Windows Phone page.

image

image

Just tell me which one is which and I’ll give you a gift when we’ll meet next time Smile. Now rather I typing here, following slide will speak a lot:

image

After all this, if you *package* these projects, you get APPX which you can submit to the store.

This is certainly a nice move from Microsoft considering developer audience. For consumers, they can now buy app on desktop and can use it on phone. And for me this is true ‘ONE MICROSOFT’ Smile

There are many new announcements happened at //build/ to follow them and If you want to know more about Windows Phone 8.1 Features, Universal App FAQs, do visit blogs from my friends:

Namaste,

Mayur Tendulkar

Productivity Tools for Windows Phone Developers

Scott has just published a blog post titled Scott Hanselman’s 2014 Ultimate Developer and Power Users Tool List for Windows. This is a most useful list for any developer. Read it here. Thanks a lot Scott.  Smile

I too, have my personal list of tools & NuGet packages which I use regularly while building Windows & Windows Phone apps and I wanted to share them here. Just my 2 cents to above list.

  • Phone Theme Manager
    In your app, you may want force the app to use one theme in particular, irrespective of system theme. OR use some different Accent Colour. A nice NuGet package can do a magic for your app.

    NewMenus
     

  • MVVM Light Framework
    Laurent has built this nice framework to expedite MVVM development. You can build your own framework and start from scratch, but it will be reinventing the wheel. Rather use this framework with Portable Class Libraries and build apps for both Windows & Windows Phone with maximum code reuse. You can read my old post about how to get started.

    Capture2

  • Multilingual App Toolkit
    A useful tool to build multilingual apps for Windows & Windows Phone. You may read my previous blog post about how to use this tool.

    image_thumb3fv

  • Syncfusion Metro Studio 2.0
    While developing Windows & Windows Phone apps, you’ll need icons for Application Bar. You can design your own icons using this tool. It allows you to customize the icons and allows allows you to export it as PNG or as a vector data for resolution independent scales.
    An alternative can be: The Noun Project

    image

  • PerfecTile
    You require to design number of icons, images (with different resolution and scale) to attach to your project as logos and other items. Use this tool to generate those images.

    image

  • Windows Phone Power Tools
    These tools are extensions to what Windows Phone SDK provides. e.g below table can give you more details.

    Capture

  • Windows Phone Emulator Skin Switcher
    This tool just changes the skin of your emulator. Nothing fancy, but cool to showcase different device during presentation Smile

    emulator skin switcher wxga_thumb

  • IsoStoreSpy for Windows Phone
    This cool utility can be used to explore Isolated Storage on Windows Phone and explore what data goes inside the apps.

    IsoStoreSpyPreviewImage
     

  • XAML Spy
    As the site says: XAML Spy is the visual runtime inspector for Silverlight, Windows Phone, Windows Store and WPF apps. It provides unprecedented access to all aspects of any running XAML app. Interact with the UI visual tree, monitor events, extract XAML, explore the contents of the package and isolated storage, view statistics and more, much more.

    quickstart.darktheme

  • Windows Phone Desktop App
    This is for both developers and consumers. You may want to sync your data between machine and Windows Phone device. You can easily plug-in the device and move/sync content. For Windows 8 there is Windows Store app which makes it easy. For Windows 7 you can use this desktop app. Most interesting feature of this app, which I can’t find difficult otherwise, is to sync podcast. Give it a try Smile

    image

  • Zune
    If you’re Windows Phone 7 developer or consumer, you’ll require this tool to sync data between device and your laptop. This is also a great media player and podcast downloader.

    image

These are the basic tools and NuGet packages required for everyday Windows or Windows Phone developer. There are some third-party control sets from vendors like Syncfusion, DevExpress, Telerik, ComponentOne, Mindscape, Infragistics and I’ll talk about them in future posts.

I hope, I’ve covered most of them here. If you’ve any suggestion or you know any tool and want to include here, do let me know.

Cheers,

Mayur Tendulkar

Localized Apps for Windows Phone 8.0

If you want your app to be used by millions, localize it. In countries like India, it is a must have feature. Think about having an app allowing farmers to sell their produce directly to the customers. In such scenario, many farmers don’t know English and are used to, to their native language. It doesn’t make any sense to build an app which can’t communicate and relate with them. Rather, having an app in their own language can help boost the productivity, sale and profit. Lets see how we can build such apps.

Normally, we use resource files to store strings and various resources pertaining to different locals. To help building such resources for different locals, Microsoft has provided Multilingual App Toolkit. Download and install the toolkit from here

Lets start with building a Windows Phone application, which will welcome users in their own language. For the sake of understanding, we’ll keep it simple, one page app. The design will look like the one as shown below:

image

For this, I’ve modified the code as shown below:image

To have text for both English and Hindi languages, lets first add a text for English in ‘AppResources.resx’ file under ‘Resources’ folder. After adding text, it should look like:

image

You can add as many resources as you want to have it displayed on the screen.

Now, to enable multilingual features (Hindi in our case), if you’ve installed the toolkit then from ‘Tools’ menu click on Enable Multilingual App Toolkit.

image

Now to add support for Indian language, right click your project and click on ‘Add translation languages’. This will bring following dialog. Select ‘Hindi’ and click on ‘OK’. Note: You can select as many languages as you want. So, your app can show data to any user in their own language supported by toolkit. :)

image

It will add another file named ‘AppResources.hi-IN.xlf’ in Resources folder (for each language selected above). Double click that file to open the toolkit. In this dialog, resource file for Hindi, will be already populated with content similar to AppResources file.

image

On this screen, click on ‘Translate’ > ‘Translate all’. It will automatically translate all the texts which can be translated. If anything fails, you can manually change it.

image

Now save the file and come back to Visual Studio.

Even though, we’ve added resource strings for English and Hindi, we haven’t bind it to actual text control. Modify the text control with following code:

image

This code, at runtime, binds the textblock to text in selected language’s resource file.

After this, first, try the app using default language i.e. English. When you run the app in emulator, it will look like:

1

Here, app shows text ‘Welcome friend’ in English. At this point, change the language and local to Hindi, India to test the app in Hindi language. To do this, go to Settings > Language+Region and change it to India with following setting.

1.2

Here, you may need to restart the phone. After restart, deploy the app again and you should see the following screen:

2

This is just the beginning of multilingual app. You can add as many languages as you want. And not just text, you can add any type of resource (image, icons sound, etc…) in your resource files.

By building multilingual apps, you can reach more users. This means more money and a successful app. Hope this helps.

Refer:

Cheers,

Mayur Tendulkar

Cross-Platform. Hybrid or Native?

Recently I had to build an app for our company (zevenseas) which can work across all the platforms i.e. Windows Phone, Windows 8, iOS (iPhone, iPad) and Android (Phone and Tablet). I started looking for various options like Titanium, Icenium, PhoneGap & Xamarin. Considering the options I had, I chose two best solutions Icenium and Xamarin. But like many, I was confused about which one to use & when, one being hybrid and other native. So, I used and tested both and here are my findings in this post.

Experimenting with Xamarin – A native solution

I started using Xamarin (build on top of Mono) since February 2013 and I’m loving it. Just think about writing apps for Android/iOS/Mac using the language that you’re using since years – C#. The best feature that I can see which Xamarin provides is one solution to build them all. Just think about having one solution, which has all the required projects & dependencies at one place. Everything in one IDE (Visual Studio), one solution and in one repository, built using one language. This is AWESOME. The other most important feature for me is Portable Class Libraries (PCL). Think about having your Data Access Layer, Business Logic Layer, Models, etc.… into PCL and then referring it into various different applications. Just create UI layers. 100% code re-use. Isn’t it? So, think about project structure like this:

image

Other awesome feature which I liked about Xamarin is, their releases aligned with release of .NET features, iOS and Android. You can use LINQ, Async/Await, PCL in your cross-platform project. One more thing to mention here, Xamarin provided support for iOS7 as soon as it got released. Pretty amazing.

The challenges with Xamarin

I can see some challenges with Xamarin & yes, those can be addressed. First one is third-party SDKs equivalents and controls. Recently Xamarin is coming up with their components-store and I’m waiting for few SDKs and components to appear in it. Perhaps, this can be a great opportunity for some folks to build and sell their components/controls. For example, I wanted to build mobile app to fetch data from SharePoint. For Windows Phone, there is SharePoint SDK for Windows Phone. Being lazy, I wanted that same SDK as Xamarin component. It is doable. No doubt. But if somebody can provide it to me, or provide solution to migrate these kind of SDKs to Xamarin I’ll be happy. (btw, Xamarin has something called scan my code which analyses the code and tells you how much of it can be reused across platforms).

Capture

In case of controls (like Telerik, Infragistics, ComponentOne, Mindscape and Syncfusion), it would be great if I can port/use existing controls (without reinventing the wheel) written in .NET; in my cross-platform solution. I know, it is going to take time, but still.

Second challenge that I found is if I want to build highly touch intensive app like which includes drawing/animations/etc…. manipulating that in C# can be difficult. Same can be achieved with existing JavaScript libraries in Icenium. Although there is MonoGame for game development, works just like Xamarin products and built on top of Mono.

Playing around Icenium – A hybrid solution

I have fair understanding of JavaScript/JQuery and have used JQuery Mobile to build mobile web-apps. So, getting used to Icenium was damn easy. The great thing I loved about Icenium is, I can use same code (UI, DAL, BAL, etc…) for all the platforms. Plus, I can run any simulator and test the app LIVE. When I say live means, just make a change in HTML/CSS/JS, save and the it affects the app in simulator. Too good. Plus these simulators are pretty fast. In case of Android emulator, if I start it, I can easily go for a walk, have a cup of tea and still emulator is booting-up on my machine. I’ve ‘one of the best machine’ – thanks to zevenseas.  (P.S. Xamarin has nothing to do with Android emulator. It uses Android’s native emulator i.e. AVD etc.…, which by default slow. You can try Intel HAXM & Intel Atom based Android images in this case)

image

Being hybrid app platform, I can use all existing JavaScript libraries including Jquery mobile, Kendo UI or what not. The list is endless. This is LEGEN—wait for it DARY… The challenge with Xamarin (third-party libraries) can be solved here. Other feature which I liked the most is, you can build the app and run or test it on Android or iOS device without developer account. It uses something called Icenium Ion. Because *i think* provisioning profiles is pathetic with Apple. Microsoft and Google are way better in this case. However, remember that at the end you need developer account to publish the app. You can delay this, but can’t skip.

image

The challenges with Icenium

I found some challenges when dealing with Icenium. First, if you already have your existing logic in C# (in case of Xamarin, PCL is the best solution), then porting it to hybrid app (JS) can be time consuming affair. You may need to re-write. But this re-write can help you to use that code across platforms. Second, the simulators are not active simulators and has some limitations. Which means, you can’t use hardware buttons like back/home/menu etc… on Android/iOS. Keyboard inputs work from real keyboard connected to development machine. You also can’t test most of the Cardova plug-ins.

Apart from these challenges, I found both Icenium and Xamarin good options to build cross-platform solutions. So, the question is when to use what?

  Icenium Xamarin
Use existing C# Knowledge and code
Incl. Async/Await, LINQ, PCL, etc…
 
Use existing JS knowledge and code
Inc. Jquery, JQMobile, KendoUI, etc…
 
Cross-Platform
(Windows Phone/8, Android/iOS/Mac/Desktop/XBOX)
Android & iOS

Edit: I just found that Icenium as IDE allows you to build apps for Android, iOS. However, the same code can be used to build for Blackberry and Windows Phone externally i.e. like using Visual Studio to build XAP (Windows Phone package). Using respective build process. Thanks to Lohith for pointing out my mistake.

When it comes to documentation and support, both of these solutions are good. Xamarin uses default .NET APIs which you already know. In case if you’re looking for platform specific API, while going through Xamarin docs, you can navigate to Apple or Android documentation. Basically, Xamarin has one-to-one API mappings/bindings (just for example, it may be different. I don’t know internals). So, it makes life easier. Icenium on the other hand, is all JavaScript. You may need to check with each JS library vendor for documentation. Support is good as both the solutions have active forums and twitter handles to ask questions.

I will not talk about performance. I haven’t built similar kind of application using these two solutions to check performance. Hence, I can’t comment on this point.

So far I’m loving both of these solutions to build cross-platform applications and I’ve my own reasons to choose right-one at right-time. Do you? Do let me know if you need any further information.

Namaste,

Mayur Tendulkar

Build Windows Phone Apps In A Jiffy

Want to build Windows Phone apps? Don’t know anything about development or just want to get started, build working POC and hand-over to professional for final touch? Or just want to try your hands on Windows Phone development? This is the ‘right time’.

Today, Microsoft announced a Windows Phone App Studio for the savvy developer filled with great ideas but not enough time.

1

You can create apps in just 4 steps.

  • Select a template
  • Add content (static or dynamic like RSS feeds, HTML, etc…)
  • Choose the style, logo, design or do full customization
  • Use it, Share it, Publish it

2

The app created using this has a high-standard code and is ready to publish on Windows Phone store. Just download the package and publish it using your publisher account on Windows Phone Store. Don’t have one? Well, you can get one in just $19 “Summer Break” limited-time Dev Center registration offer (through August 26, 2013).

I hope, this will help you to get started with Windows Phone development and build that one mobile app, you always wanted to build Smile

Resources:

Namaste
Mayur Tendulkar

Windows Phone ‘Hello World’ App Using MVVM Light

When building any application, it is always a good practice to follow tried and tested design-patterns which will help in separation of concerns, code-reuse, maintainability, testability etc.… Just like ASP.NET there is MVC, for XAML based technologies (like Silverlight, Windows Presentation Foundation, Windows Store and Windows Phone apps), there is MVVM.

In this case, MVVM stands for – Model View ViewModel. As name suggests Model is nothing but classes representing data/entities. View represent actual view (pages in this context) whereas ViewModel does the binding between View and Model.

There are many frameworks out there which helps to build Windows Phone apps using MVVM pattern like Prism from Microsoft and MVVM Light from GalaSoft. In this blog, we’ll focus about MVVM Light.

First create a Windows Phone application.

image

Select Windows Phone 8.0 as OS Version in next dialog box.

Now, click on TOOLS > Library Package Manager > Manage NuGet Packages for Solution and search for MVVM Light in Online Gallery and install the same

image

When MVVM Light toolkit is installed, it modified App.Xaml file to instantiate the ViewModelLocator. These ViewModels are added in ViewModel folder.

image

MainViewModel is responsible to communicate between view and model. However, to keep things simple, we’ll expose a ApplicationName property which we’ll bind to Page.

image

Now, to bind ViewModel to View, in MainPage.xaml, add following code in phone:ApplicationPage element:

image

Now, bind ApplicationName to the textblock which displays App Name in MainPage.xaml

image

As soon as you modify above code, the UI changes and shows the Application Name. This is the beauty of using MVVM.

image

In next few blog-posts we’ll explore more about patterns and best practices in Windows Phone applications. Stay tuned! Smile

Resources:

Namaste

Mayur Tendulkar