Xamarin Apps with Business Central integration – Part I

Xamarin Apps with Business Central integration – Part I

Hi all,

I know that PowerApps and PowerApps Portal are the future but in this post I want to talk about the possibility of creating apps developed on Xamarin Framework connected to Dynamics 365 Business Central; the connection happens through the consumption of Web Services and OData, as already seen also for the Web Applications (take a look to my old post MVC Web Apps with Business Central Integration)

https://robertostefanettinavblog.com/2019/07/12/integrate-mvc-web-applications-with-business-central-soap/

Xamarin was acquired by Microsoft a few years ago (2016) and is currently available in Visual Studio (and also in Visual Studio Community Edition 2019)

Xamarin VS Flutter – Battlecard

If you want to see the differences between Xamarin (Microsoft) and Flutter (Google) we point out this very interesting post:

https://blog.codemagic.io/flutter-vs-xamarin-a-developer-s-perspective/

You can find a nice Battlecard between Xamarin & Flutter.

PowerApps and PowerApps Portal

https://powerapps.microsoft.com

Example: a simple PowerApps Application:

wsItemList” exposed Odata source connected to Business Central, one page demo layout. A lot of great features are today available in PowerApps!

Layout Demo

…but, as already mentioned, in this this I want to talk about Xamarin….

About Xamarin: what is Xamarin?

“Xamarin is an open-source platform for building modern and performant applications for iOS, Android, and Windows with .NET. Xamarin is an abstraction layer that manages communication of shared code with underlying platform code. Xamarin runs in a managed environment that provides conveniences such as memory allocation and garbage collection.”.

Xamarin applications can be written on PC or Mac and compile into native application packages, such as an “.apk” file on Android, or an “.ipa” file on iOS.

Screenshots of example Xamarin application in iOS and Android

Xamarin is for… ???

Xamarin is for developers with the following goals:

  • Share code, test and business logic across platforms.
  • Write cross-platform applications in C# with Visual Studio.

Diagram of Xamarin architecture

Xamarin.Essentials

is a library that provides cross-platform APIs for native device features. Like Xamarin itself, Xamarin.Essentials is an abstraction that simplifies the process of accessing native functionality.

Some examples of functionality provided by Xamarin.Essentials include:

  • Device info
  • File system
  • Accelerometer
  • Phone dialer
  • Text-to-speech
  • Screen lock

Xamarin.Forms

is an open-source UI framework. Xamarin.Forms allows developers to build iOS, Android and Windows applications from a single shared codebase. Xamarin.Forms allows developers to create user interfaces in XAML with code-behind in C#. These user interfaces are rendered as performant native controls on each platform.

Some examples of features provided by Xamarin.Forms include:

  • XAML user-interface language
  • Databinding
  • Gestures
  • Effects
  • Styling

NICE XAMARIN.FORMS EXAMPLES HERE

https://docs.microsoft.com/it-it/xamarin/xamarin-forms/samples/

Xamarin Apps with Business Central integration

For example it is possible to use Xamarin to create an application that can read data via WS “OData”, load it into Xamring.forms, update data via Odata, an APP which can be used on multiple platforms (Available for Windows, Android, iOS).

  • Crate\configure a New Project

A PROJECT LAYOUT LIKE THIS: A MULTIFORM APP

  • Example for multiforms project with TABS, you can create more tabs (forms) to launch other pages from a master browser form like this example.

Global APP Configuration (Package appmanifest file)

You can use a Global APP Configuration to configure the application (ex; Rotation, Language, Visive Assests, exposed features)

SIMPLE DEMO APPLICATION: “Warehouse Management”

A simple application to declare Consumptions, Reclassifications movements in Business Central via Xamarin.Forms; you can add more features to manage Inventory etc. etc.

Application (Solution)

Packages and APIs

Dependencies & Lib in Project

  • Newtonsoft.json
  • Xamarin.Essentials
  • Xamarin.Forms
  • Xamarin.Datagrid
  • WebApi
  • Odata
  • Application Forms

WarehouseManagement.App

VIEWS

WEBAPI.cs

“WS CONNECTION” SAMPLE

VIEWS

public bool Login()

{

var response=WsConnection(“https://api.businesscentral.dynamics.com/v1.0/<Tenant ID>/ODataV4/Company(‘Company’)/login”);

if (response.StatusCode == System.Net.HttpStatusCode.OK)

return true;

else

return false;

}

“LOGIN PAGE” SAMPLE

…wait for part II of this post to see the APP in action on Windows and Android.

See you soon in “Xamarin Apps with Business Central integration – Part II”!

2 thoughts on “Xamarin Apps with Business Central integration – Part I

  • 29 January 2020 at 8:48 AM
    Permalink

    Hey,

    Thanks for putting together this post on Xamarin apps. I particularly find your thoughts on Xamarin Forms very interesting.

    I’m glad to find another amazing mobile app development blogger.

    Cheers.

Comments are closed.