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

Advertisements

tendulkar-uvāca : Episode 2

In previous episode of tendulkar-uvāca, we’ve seen how we can setup our development environment using Visual Studio and Xamarin.
In this episode, we’re going to see how we can use emulators to test and debug our applications.

iOS simulators will get installed with XCode is installed.
For Android emulator, install Xamarin Android Player from here
Windows Phone emulators can be installed while installing Visual Studio 2013 Update 3.

Do let me know your feedback and suggestions.

Namaste
Mayur Tendulkar

Plugin 05: Accelerometer

In our series on plugins, today we’re going to cover plugin which can help us to work with Accelerometer sensor. This sensor is responsible to detect X, Y, Z co-ordinates of the devices. Using data received from this sensor, you can build games like TempleRun, where users can collect the coins by tilting the device.

There are different APIs for different platform and their usage is different too. First, lets see how we can use this sensor in different platform and then we’ll use plugin in Xamarin.Forms application.

Being Windows Runtime API, the API and its usage is same in Windows and Windows Phone. Here, you create object of the sensor and register for ‘ReadingChanged’ event. Whenever device position is changed, it is reported through that event and UI can be updated using Dispatcher.

In case of Android, it is again similar to Windows platform. Create object of SensorManager and register for SensorChanged event.

iOS is not any different. You create object of CMMotionManager and then listen to sensor for changes.

As you can see, for three different platforms the APIs are totally different. But with Plugins for Xamarin.Forms it becomes easy. You can use DeviceMotion plugin which can work across all these platforms. And the code for same looks like:

In this series on plugin we’ve seen how particular concept can be implemented in all the three platforms and how we can use plugin to make life easier. This will be be last post in this series, but there are many plugins available which you can explore and use in your projects. Do let me know if you want to cover any specific plugin. We’ll start with a new series in couple of weeks. Till then… happy coding :)

Namaste
Mayur Tendulkar

Plugin 04: FileIO

In continuation to blog posts in this series on plugins, today we’ll cover a plugin/library to perform FileIO.

There are different APIs on different platforms to perform FileIO. Having said that, Xamarin already makes life easier by implementing System.IO which is available in Android and iOS.

Following code can be used in Android to create a file and then read contents from it.FileIO - Android

Similarly, following code can be used in case of iOS application. FileIO - iOS

In case of Windows, using WinRT APIs, the case is little bit different as shown below:FileIO - Windows

Now to make life easier, there is a NuGet from Daniel Plaisted, which can help you to use same code on different platforms. You can find more information about the library from here: https://www.nuget.org/packages/PCLStorage/FileIO - Forms

This way, you can use one code (in C#) across all the three different platforms.

Hope you’re enjoying this series. Do let me know your feedback if you want to include any specific libraries/features.

Namaste
Mayur Tendulkar

Plugin 03: Phone Calling

In continuation to blog posts in this series on plugins, today we’ll cover a plugin to make phone calls.

As we understood before, all platforms support phone calling (just like emailing, texting, etc…) and Xamarin makes it easier with one common language – C#. However, developers still need to learn

In case of Windows Phone, one can initiate a phone call by using following code. In this case, Windows Phone has special class which allow developers to perform this task.

Screenshot 2015-02-23 10.53.12

In case of Android, developers can use ‘Intent’ and ‘URI activation’ to start a new phone call.

Screenshot 2015-02-23 10.56.09

In case of iOS, same concept of URI activation can be applied. As shown below in the code, developers can create a URI with telephone number and it will launch default application to make a phone call.

Screenshot 2015-02-23 11.13.09

Now, in case of Xamarin.Forms developers can use same Messaging Plugin for Xamarin and Windows plugin to implement phone functionality across the platforms.

Screenshot 2015-02-23 12.31.23

This way, developers can utilize the power of plugins to write one code which can work across different platforms, without bothering about underlying APIs.

Namaste
Mayur Tendulkar

Don’t Re-Invent the Wheel: Use Components or Plugins In Your Apps

Xamarin provides native, cross-platform mobile application development using language we all know and love – C#. However, it is still required to learn concepts of each platform. For example to send text message (SMS) in all these three platforms there are different set of APIs.

Below API is for Android, which uses SmsManager to send the text message. There is another way to do this using Intents.

image 

In case of Windows Phone, ChatMessage allows us to declare and send text message. This API is available in WinRT platform. In case of SL based apps, we need to use Launchers/Choosers.

image

In case of iOS as shown below, there is no API as such. But we use URL to launch default messaging app. In this case, we cannot set the message body, which we want to send out.

image

Life will be much simpler if there will be just one API on all these platforms which will take care of sending text messages and as I developer we don’t need to bother about on which platform it is being called. Here comes components and plugins. My friend James has written a nice blog about ‘What Exactly is a Plugin for Xamarin?’. You can read it here

In our case, we’re going to use Messaging Plugin for Xamarin and Windows which allow us to use same API to send text messages. Below code is written once in a Xamarin.Forms project which depending on platform on which code is executing, send the message using that platform’s APIs.

image

Using this plugin, it becomes easier to send text messages on Android, iOS and Windows. And this is the magic of Plugins for Xamarin.

In future posts, we’ll cover some of the best plugins and components which can help you build cross-platform mobile applications with single code-base.

I hope you’ve enjoyed this.

Namaste
Mayur Tendulkar

Revisiting Evolve – Insights

One of the factor for successful app is – continuous feedback from user. Even though, you anticipate all the possible bugs, once the app is on store, you’ll never know what can go wrong and when your app can crash on the user. You may want to know: how many users are using your app, when they are using, how they are using, what features they are using or if the app crashes, when, why and how it crashed. These analytics can help you to engage more with the audience and deliver great apps.
Thanks to Xamarin Insights, which was introduced in Evolve 2014. Using Insights, you can easily track down all these scenarios.
To get started visit https://insights.xamarin.com/ and create a new app.

Screenshot-2014-10-20-11.31.43

 

Insights is supported on Android, iOS and Windows/Phone apps. Using NuGet package, add Xamarin.Insights NuGet Package.

Screenshot-2014-10-20-11.35.20

 

Once you add this package, you need to initialise the Xamarin.Insights by using following code:

Screenshot-2014-10-20-11.40.34

Just remember, you need to initialise Insights before any exception can occur. For example, in case of iOS in Main, in case of Android in OnCreate of startup activity and in case of Windows in Launch event.
After this, whenever there will be any unhandled exception, it will be reported on the dashboard. To simulate this behaviour, lets add a button on screen and catch the exception and report it explicitly.

Screenshot-2014-10-20-11.42.39

As you can see, above code will raise IndexOutOfRangeException. Now, if you run the app in ‘release’ mode on ‘device’, it should show all these exceptions on Dashboard.

Screenshot-2014-10-20-12.17.12

Now, if you click on individual exception, you can see more details (incl. stack-trace) for that exception. This will also tell you more details about device on which app is running, the version of the device OS and other details.

Screenshot-2014-10-20-12.17.12

 

On this dashboard, you can go to Users tab and see individual user actions and how they received those exceptions.

Screenshot-2014-10-20-11.54.01

 

Insights give you APIs to report more details related to Users (individual user details like name, email id, etc…), their actions or traits (clicked on some button, navigated to some tabs, etc…) and also to add more details to exceptions. It can also send you email for individual issues. So, if there is any issue with high-priority, you’ll receive a notification mail and get notified about it. Insights, also allows you to integrate with HipChat, Jira, Visual Studio Online to get notified about issues.
Using Insights, you can easily engage more with your audience. If user is facing any issues, you can get notified about those issues. And once you solve those issues, you can contact user about updates. This will help your users to use your app more frequently while making it a successful app.
You can find more details about Insights at: https://insights.xamarin.com/docs or http://xamarin.com/insights
Hope to see more apps with Insights and user engagement.

Namaste
Mayur Tendulkar