Mobile Development

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

15
Jan

Speech Recognition in UWP

In Windows 10 the Microsoft’s voice assistant Cortana was introduce and came as a part of desktop. A small Cortana query box is sitting on the right side of the Start button, ready to take a voice command. In order to launch it, one should always start the phrase with “Hey Cortana” or activate Cortana by clicking on the box to listen.

Read more

13
Jan

Analyzing Xamarin app performances using Android Device Monitor

Application performances are important. When application doesn't perform fast enough or crashes often, users are unhappy and application is doomed to fail. This is especially true in mobile world, where everything should be fast and responsive.

If you are developing cross-platform application using Xamarin and you run into performance issues, you may be in a bigger trouble than initially expected. The reason is multiple levels of abstractions, different memory heaps on different levels, unmanaged code and memory… You need a good profiler.

Read more

22
Dec

Building Xamarin Android application using Team Foundation Build 2015

During 2015 Microsoft presented new, scriptable build system that's web-based and cross-platform. New build system is easy customizable and it's intended to replace old XAML based mechanism.

Every build definition is made of build tasks. In order to kick start build definition creation process, there are predefined templates available.


Read more

18
Jun

Attach Behavior in Xamarin.Forms

Xamarin.Forms behaviors lets you add functionality to user interface controls without having to subclass them. Attach Behaviors extend object functionality without writing a new control. In this video we will show the example of validating user inputs.

11
Jun

What Will the Future of Mobile App Development Look Like?

A little over a decade ago, most people had no idea what a mobile application was. Today, it’s hard to find someone who doesn’t know what they are. Mobile applications have become so entrenched in our lives that it can be difficult to believe there was a time when they didn’t exist.

Much like mobile applications themselves, the technology used to develop them continues to change and improve. New technologies will enable developers to deliver a higher quality user experience, making it easier for users to accomplish their goals through their mobile devices.

What does the future of mobile application development hold if it continues to change and improve rapidly? Here are some predictions.

Read more

15
May

Implementing Navigation Drawer in Xamarin Forms

Every mobile application which is going to be used as real world app requires navigation solution. On Android platform recommendation for effective navigation is Navigation Drawer. It is a panel that transitions in from the left edge of the screen and displays the app’s main navigation options. More info about Navigation Drawer and it’s capabilities you can find on Android developer site.

Other platforms have similar solutions, so if you are developing in Xamarin Forms, it is a good idea to empower this kind of navigation. Plus side for Xamarin Forms it that you would write Navigation Drawer in only one codebase.

Read more