Mobile Development

19
Feb

Time zone conversion in Xamarin Forms XAML using NodaTime

When developing mobile applications for multiple platforms it can be important to understand how to implement time zones conversion in elegant manner.

Read more

24
Apr

Creating touch responsive (animated) button in Xamarin.Forms Android

Sometimes we would like to have a bit more user action responsivity when handling our apps. This post explains how to create tactile buttons in Xamarin.Forms using custom renderers to do so for Android.

First, we need a custom control that would represent our tactile button, so let’s create it.

Next, we would need to create a custom renderer class that would take care of button’s touch sensitivity.

To create the button pressed look and feel, in this example, we need to animate the button or to add a scale animation when button is pressed and un-scale when button is released. One of the ways to do that is to subscribe to button’s touch event. Implementing these overridden methods in your custom renderer takes care of subscribing and unsubscribing from the button’s touch event.

Finally, animating the button to have a little touch responsivity here comes down to scaling to a smaller size on mouse down, and returning to original size and launching command (if exists) on mouse up.

All you have to do now to start using these new buttons is to add them to your view!

Cheers!

4
Jan

Remotely controlled nightly memory cleanup on Android devices

Imagine you have an enterprise application running on hundreds or thousands of mobile devices in field. Your application is being used every day, and it is rarely being restarted (users prefer leaving the application in the foreground all the time).

While we all tend to create applications that are memory responsible, the reality is that there would be memory leaks. With intensive usage of the application described in the example above, even small memory leaks would eventually cause the issues (application malfunctions or breaks).

Our Android application is developed using Xamarin.Forms. Our server runs on Azure and exposes REST API developed using ASP.NET Web API. Server communicates with the mobile devices by sending messages through Azure Notification Hub and Google Cloud Messaging (GCM).

When we experienced memory related issues on devices, we started brainstorming for possible solutions. Besides fixing all noticeable memory leaks, the best way to make sure that memory is in a good state is to restart the device. This method is intrusive, not easy to implement on Android and is discouraged. But it turns out that there are a lot of applications on Google Play Store which perform “fast rebooting”. We chose FastReboot, which is lightweight and “simulates a reboot by closing/restarting all core and user processes and thus frees up memory”.

Read more

28
Apr

MVVM architectural pattern with AngularJS

AngulaJS is a framework for writing Single Page applications (SPA). It is just one of many JavaScript frameworks for developing SPA, but it is widely used. One of the reasons is that AngularJS is, as authors say, MVW framework (Model – View – Whatever).

What is MVW? There are several most popular architectural patterns for developing of web apps. MVC (Model – View – Controller) is well-known for long time and is main pattern for developing server-side code for web apps. MVVM pattern is relatively new, and it is evolving with applications for mobile devices, but has moved to SPA also.

So, AngularJS is designed to be used with whatever architecture pattern. It gives freedom to a developer to decide what pattern to use. However, AngularJS is primarily MVC framework, as it brings views and controllers out of the box.

Read more

27
Apr

First look at Visual Studio Tools for Apache Cordova

If you are a web developer and you want to develop applications for mobile devices, Single Page Applications (SPA) are the Holy Grail. It allows you to use cross-platform capabilities of HTML5/CSS/JavaScript technologies in combination of web development and design experience in order to create fully functional mobile applications.

Microsoft has recently launched Visual Studio Tools for Apache Cordova. It’s embedded within Visual Studio and allows you to create, debug and test cross-platform mobile applications written as SPA. Apache Cordova is an open-source platform which contains of set of command-line tools and plugins for creating mobile apps for different platforms. Visual Studio brings set of tools, emulators and debugger which allows you to have better experience developing such applications.

Read more