Xamarin.Forms And The Case of Failed NuGet Packages – Part 2

Most enterprise mobile apps require enterprise-level authentication mechanism. In that case, people use tried and tested Active Directory Authentication Library (ADAL) or Microsoft Authentication Library (MSAL). ADAL is in GA and it works fine with cross-platform mobile apps built using Xamarin. However, MSAL is in ‘preview’ and it offers nightly builds to try out. I wanted to try the latest nightly build (ver: 1.1.1-alpha0417) as it uses updated Android Support Package and old preview bits of MSAL (ver: 1.1.0-preview) were not compatible with latest  Xamarin.Forms anymore. Here, I was trying to build one app over holidays and I got stuck on one interesting issue. Let’s discuss it in this blog post.

The Problem:

When you create a blank Xamarin.Forms app, it automatically references Xamarin.Forms NuGet along with all the required dependencies.

At this time, when you’ll try to install MSAL, you may get stuck at this issue of versioning.

The reason being Xamarin.Forms NuGet requires a specific version of Android Support Packages whereas Microsoft Authentication Library requires anything above Ver. 25.3.1.

The Solution:

Sometimes, things are very simpler than it looks. I spent a lot of time on solving this issue but was unable to fix it. Thanks to my friend Nish, who helped me with his ‘ problem-solving skills’ and we got this working.

The solution is simple:

  1. Remove all NuGet packages from Android project. For the sake of it, close and restart Visual Studio.
  2. Open the solution and Install MSAL NuGet package first.
  3. After installing MSAL NuGet, install Xamarin.Forms NuGet package.

Bingo!

Now you can build Xamarin.Forms apps with Microsoft Authentication Library. If you want to know more about how to use the SDK, follow the blog post here on Xamarin blog.

Even though I’m talking about Xamarin.Forms and MSAL here, this blog post is very much applicable wherever you’re trying to use any NuGet package which has updated dependency on Android Support Package.

Setup info:
Visual Studio Enterprise 2017 Preview (15.5.2)
Xamarin (4.8.0.753)
Xamarin.Forms (2.5.0.121934)
Microsoft Authentication Library (1.1.1-alpha0417)

Namaste,
Mayur Tendulkar

 

Learn Mobile App Dev & Mobile DevOps Here

DevOps Meme

My friend Prachi tagged me on this meme on Facebook and I couldn’t agree more with her. When I started my career, my entire version control was folders – zipped, tagged and stored on multiple hard-disks. But then things changed. My guru Raj, enlightened me about advantages of version control systems. I learned about how multiple people can collaborate on projects or how errors can be reversed by going through code history if version controls like Team Foundation Server or GitHub are used. I started using those and these days, all my projects and samples are either in Visual Studio Team Services or in GitHub repository.  Going one step ahead, I’m using Visual Studio Mobile Center for DevOps along with these version control systems.

But what is this all about? How it helps in building successful mobile applications? And I thought about answering these questions in a video series. The goal is to explain mobile DevOps and different steps in mobile DevOps in small (less than 10 mins) videos.  After completing this series, you’ll be able to build cross-platform Xamarin.Forms mobile application, which will consume Microsoft Cognitive Service and set-up mobile DevOps for the same.

To follow along with this series, I’m recommending following minimum hardware/software combination:

  • Intel i5, 8GB, 50GB machine with Hyper-V support & Windows 10 Professional
  • MacBook or MacMini with i5, 4GB, 50GB for compiling iOS apps
  • Visual Studio 2017 Community Preview

With these hardware/software additional services used in this series are:

Watch the 1st video here about activating these tools & services to set-up mobile DevOps.

In 2nd video learn about how to setup build automation, using Visual Studio Mobile Center.

I’ll update this blog post in coming weeks with the 3rd video in this series, which will be about building mobile applications.

Stay tuned and subscribe to my blog/channel :)

Namaste.
Mayur Tendulkar

Mobile Mindset for five star mobile applications

These days anyone can write mobile applications. With tools like Xamarin & Visual Studio, it has become a lot easier. But for successful mobile applications, developers need to have what I call a ‘mobile mindset‘. Mobile mindset is developed gradually after using various devices and numerous mobile applications. One can learn many things from developing this mindset. So, what is this ‘mobile mindset’ all about? Let’s discuss it in this blog post.

Before Developer, Be a Consumer

The idea is to use a hell lot of mobile applications. Try breaking the boundary of famous apps and use applications which you’ve never used before. Observe the user experience. As, a number of applications you will use in daily life, you’ll get an idea of how your application needs to be designed. You can get inspired by some applications or learn from mistakes of others.

Mobile Apps != Web or Desktop Apps

In large organizations, a pool of web/desktop developers are trained to develop mobile applications. However, there is a huge difference in mobile applications and web or desktop applications. There are constraints on screen size and resolution, battery power, processing power, network connectivity and multitasking when it comes to mobile devices. Think about all these challenges before architecting mobile applications.

Screens & Navigations

In the case of desktop/web applications, users can navigate to any page or screen anytime easily because there are menus, navigation & address bars. They can even launch another application or site for some task and come back to your application. However, this luxury isn’t available in mobile apps and if the user needs to tap or swipe in your mobile app for more than 3 times to complete 1 task, perhaps it is a high time for you to redesign the flow of your application. When it comes to screen, try to avoid distractions. Heavy use of multiple navigations, controls on the screen, advertisement banners can lead to bad user experience. There are guide available for user experience and navigation patterns. Learn about them and see which one suits for your application. And remember, more screens, more swipes and bad user experience can lead to unhappy users.

mobile-mindset-02

User-Friendly Interface

As compared to desktop or laptops, mobile devices have a small screen. It is often called as ‘screen real estate’. Use it wisely. Make controls and ‘next steps‘ discoverable. Use controls which can expand and contract depending on usage. Give hints to the user. Your app has failed if the user has to ‘google’ next steps or read the user manual to use your app.

mobile-mindset-01

Data – As & When Required

If the user is going to launch your app for the first time, treat him with respect. Don’t collect all the user details. If needed, by providing ‘privacy policy‘, ask for only required details to register with your app or service (e.g. age, email, phone, password) and get him onboard. Once onboarding is complete, depending on requirements gather the necessary information (e.g. preferences, network, etc).

On the other side, when required, download contextual data. It doesn’t make sense to download the entire brochure of products when the user is only interested in check out with the items in his cart. Use paging, pull-to-refresh mechanisms to download the data while confirming available bandwidth. A user may be connected to a high-speed wifi network or may be connected to 4G network on roaming. This can be a costly affair.

Having said that, remember, if it takes more than a minute to get to the first screen of your application when the user launches it for the first time, probably, he’ll switch to other similar application or service.

Use Feedback Channels

Before publishing your application to the store, use tools like HockeyApp to conduct beta testing. Distribute your application privately and check the impact. Include crash analytics. And once testing phase is complete, release it to the store. Because once the application is available in the store, users will download it, use it. But when it will crash, seldom they will report it. But definitely, rate it 1 star. Without annoying, ask user to rate your app. Users talking about your apps is the best marketing for your app you can get for free.

Analyse

Don’t just publish your app in the store and leave it for sinking. Use tools like Application Insights, HockeyApp, etc… which can provide details about app launches, app crashes, unique visitors. You can add code to customize the data collected like gender, age, location, preferences of the user. Consider providing ‘privacy policy‘ and notify user about collecting this information. Once you collect that data, analyze it and depending on that provide customized services to your users. Your users will be happy to receive customized offerings. But don’t overdo it.

These are some of the basics of mobile application development, which helps to build ‘mobile mindset’. Thanks to Dipankar, Pooja & Prashant for their valuable feedback over this post. Try these tips in your next mobile app and let us know your feedback through comments.

Enjoy building mobile apps. Happy coding.

Namaste,
Mayur Tendulkar