Background

In this blog, I will introduce how to use custom renderer to customize the back button icon and text in app’s navigation bar.

There is reason that why I have to log this blog. Let’s say, if you want to customize some control in Xamarin.Forms using custom render, usually you will do this: First, learn what is the native control that is wrapped in Xamarin.Forms, then you create a new class which inherits from that control’s class. After that, you will create a renderer class for that control in the platform-specific project which is Android, iOS or UWP. You will use the normal format how custom renderer does on that class and implement the OnElementChanged method for the customization logic, the OnElementChanged method was called when the control was generated. At the end, you will be able to use that new control in your XAML page file.

The official document of how to use custom renderer is here: Xamarin.Forms Custom Renderers

Read More

Background

I did one case for my customer who’s trying to binding one Android aar which is a DatePicker/TimerPicker control to his Xamarin.Android project. I helped to generate the aar file and the binding was successful. However, when trying to use the binding library, I got stuck on some code implemment.

Read More

I made a mistake / misunderstanding when writing the previous blog: Xamarin.Android vs. Native Android - How you implement Java Listener in C#, which is about how to transfer Java code to C# coding when doing Xamarin.Android project. (Means that sometimes you will have to implement some code in C# by refering to some code from native Android sample which is written in Java.)

I will keep that blog because it’s still correct but not the best practice as I can think of for now. So you can think of this as a better one.

Background

Recently I am reading a pdf which is from Microsoft official site for Xamarin.Android development. I read about the Downloadable Fonts which has more benefits than you packaged the font into the apk file.

For detail information about Downloadable Fonts, check here: Downloadable Fonts.

In the above link, you will see there is a sample from Google that demonstrate how this works.

Here is the link: android-DownloadableFonts

But I am learning Xamarin.Android so I thought maybe I can try to implement it with a Xamarin.Android version. (Usually I will use Xamarin.Forms for developing Xamarin app.)

Then the nightmare happened, I found it really hard to implement the code just by reading the Java code from Google’s sample, even C# and Java are quite similar.

The good thing is that I suddenly found that Xamarin team has done a sample for Xamarin.Android also, it’s exactly the same as Google’s sample. Which means that someone has done the same thing as I want to.

Here is the link: Xamarin.Android DownloadableFonts Sample

I checked the code and it’s quite good and elegant.

So, what you will see in this blog is that I am gonna use these 2 sample projects to get through some important points and practice that how you can do Xamarin.Android development if you need to refer to a native Android project.

Read More

It’s really important for engineers who use Xamarin to develop Android app to know how to transfer Java code to C# code.

Recently I am trying to implement something in Xamarin.Android project (Not Forms) and I encountered lots of issues.

What I can find online is mostly Android native documents from Google. And I do find one sample project from Google that is implemented in Android Studio using Java.

So what I have to do is to understand how to transfer Java code to C# code, otherwise you will find it quite difficult to use pure Xamarin.Android project.

Read More

Background

In recent years, it becomes more and more common that enterprises are tranferring their websites to mobile apps. By transferring, I mean that they want both versions of their apps. That will give us a scenario that our users, especially for Microsoft customers, they will want a same database structure even a same set of Web API to use for both Website and mobile apps.

This blog is exactly the same situation here. I got one customer who already has a website and its Web API is based on .NET Core 2.0. However, he’s trying to use the Xamarin.Forms to build an app and also using the Azure Mobile Apps SDK to enable the offline sync feature in his app.

Of course, he wants the Web API to be the same for both Website and Mobile app.

What is Offline Sync?

If you use a mobile app, you will be handling data sync with the database. When the network is good on your mobile, you will never meet issue to query/add/update/delete from database and sync back with your mobile app.

However, you will never be confident that your mobile will always be under a good network situation. That’s where the offline sync fit in.

Offline sync allows users to interact with a mobile application, viewing, adding, or modifying data, even where there isn’t a network connection. Changes are stored in a local database, and once the device is online, the changes can be synced with the Azure Mobile Apps instance. This article explains how to add offline sync functionality to a Xamarin.Forms application.

Read More

Background

I got one customer who wants to achieve the below effect for Android Secondary Toolbar:

Expected Effect

Originally I thought it might be a really bad thing for Xamarin only because I assume that Android native can directly achieve this.

However, after further analyzing, I found that the reason why Xamarin Secondary ToolbarItem cannot do as this is due to Android native is also doing the same.

Read More

Background

I got one customer who wanted to find all the installed Windows Store App using WPF platform. However, you cannot code in WPF because the current SDK for querying such information only supports UWP, not WPF.

After some research, there is one PowerShell script Get-AppxPackage -AllUsers which will return all the installed Windows Store apps under all the user accounts in that PC.

Reference link:Get-AppxPackage

So what we will show here is how to use .NET library to call PowerShell scripts.

Read More

Background

This article is a further topic of last WebView version. I mentioned in that article, the pro for WebView version is easy to implement. However, using that approach, we will totally depend on the bot development, there is no much things to do in Xamarin development.

Also, Google has published lots of restricts to use WebView.

In this article, I will introduce another approach which is also recommended by myself. We are going to use Direct Line Service to communicate with our Bot using Xamarin app.

Read More

Background

Nowaways Microsoft focuses on the Azure products especially in the AI area. This article is to demonstrate how to migrate Bot Framework into Xamarin.

The reason why I wrote this article is simple. I support Xamarin product in MS, and I’d love to learn the technology for Bot. After this article, I will write different topics also, such as how to migrate Azure Cognitive Service to Xamarin, etc.

Technical Skills

  • Xamarin (WebView)
  • Bot Framework (Web Chat)

What you need to know

You should have some basic knowledge on Xamarin and Bot Framework to read this article. This article will demonstrate how to migrate a Web App Bot into Xamarin application. Since it’s a web app bot, so it’s possible to use it directly in the WebView.

There will be one more artile regarding how to use Direct Line Service as the channel to communicate between Bot and Xamarin. In that case, the channel of the Bot will be Direct Line.

Read More

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×