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.
Uvāca – simply means ‘says, explains, describes’ and ‘tendulkar-uvāca‘ means ‘tendulkar-explains’. Through this series, I want to share my experience and whatever knowledge I’ve about mobile, cross-platform and apps for gadget development. The idea is to help people understand these technologies in any possible way. Here are first two videos from this series.
Hope you’ll like these videos. Do subscribe to the channel and blog to get updated contents and also let me know your feedback (be it positive or negative). Also let me know if you want me to cover any specific topics.
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 :)
This time, Microsoft India is hosting its ‘Microsoft Azure Conference 2015’ in Pune. This is going to be a huge event for any cloud enthusiast with 2 days and more than 70 sessions. More details about this event is available here: http://www.microsoftazureconference.in/
In this event, I’m going to conduct a hands-on-lab on ‘Put Office 365 in Your Xamarin Mobile Apps’. In this lab, attendees will learn how to integrate Office 365 services in their mobile applications (Android, iOS and Windows)
As a homework, I’ll recommend to go through following links:
This will help you to understand the topic and be prepared for lab.
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.
Similarly, following code can be used in case of iOS application.
In case of Windows, using WinRT APIs, the case is little bit different as shown below:
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/
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.
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.
In case of Android, developers can use ‘Intent’ and ‘URI activation’ to start a new phone call.
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.
Now, in case of Xamarin.Forms developers can use same Messaging Plugin for Xamarin and Windows plugin to implement phone functionality across the platforms.
This way, developers can utilize the power of plugins to write one code which can work across different platforms, without bothering about underlying APIs.
In previous blog post we’ve seen how we can use plugins to send text messages and use same API across platforms without bothering about individual platform specific APIs. In this blog post we’ll continue to discuss plugins and see how we can send Email messages.
In case of Windows Phone, we can use EmailManager to send EmailMessage. The code will look like:
For Android, there is no class as such which can handle email messaging. Rather, we use something called as Intent.
In case of iOS, we use built-in controller to pass parameters which can populate the email message and later-on send it.
Now, lets see how we can implement this feature in Xamarin.Forms using Plugins. The plugin which we used last time, is feature rich and also included capability to send emails. Refer Messaging Plugin for Xamarin and Windows in your applications and modify the code as shown below. Depending on the platform on which the code is executing, it will internally call the platform specific APIs.
Once again, using this plugin it becomes easy to send Email on Android, iOS and Windows Phone.