I’m going to explain how using biometric identification in Xamarin Forms to simplify authentication before executing certain important actions
Category: Xamarin
Configure IdentityServer for Xamarin Forms
In this new post, I explain how to configure IdentityServer for Xamarin Forms to integrate Web Authenticator using Xamarin Essentials
Authentication in Xamarin Forms with IdentityServer
I want to start to use Visual Studio 2022 Preview and create a base Xamarin Forms project integrated with IdentityServer
Uno Platform now lets you develop for macOS, Windows, and more using the same code
Uno Platform announced today that it now supports macOS as a target platform. This new support means that developers can use a single code base to create apps on Windows, iOS, Android, the web, and macOS. According to Uno Platform, this makes it the first and only cross-platform solution to allow the same codebase to run on all these platforms. Uno Platform allows developers to use C# and XAML code to create native apps on several platforms. Rather than running through Electron or emulation, apps that utilize Uno Platform can…
Adapting to Enterprise and B2E Xamarin Forms App Development
Enterprise or Business to Employee (B2E) mobile apps can be quite different from their B2C counterparts. B2C apps, tend to focus on a small number of screens or feed for their main usage, and additional screens are not as frequently used, but there to serve ancillary functionality as needed. B2E apps, are focused on function, normally recording or accessing data for their day to day job. Many of them are replacing hand written recordings, for digital records, that are automatically synchronized to the main database. The fact that these users…
Xamarin Forms Dependency Injection
Calling native platform code in your portable class library (PCL) is achievable via Dependency Injection. It’s a common question for people starting out, who are using a PCL or .NET Standard Library for developing their Xamarin apps. Dependency Injection involves creating an interface that can be commonly applied across all native platforms, then coding the actual implementation, or the native platform code, on each platform. This interface and instance is then given to a container. The PCL or .NET Standard Library, then goes to the container with only the interface…
Working with CarouselView in Xamarin Forms
Xamarin.Forms code runs on multiple platforms – each of which has its own filesystem. This means that reading and writing files is most easily done using the native file APIs on each platform. Alternatively, embedded resources are a simpler solution to distribute data files with an app. CarouselView CarouselView is available in Xamarin.Forms 4.3. However, it is currently experimental and can only be used by adding the following line of code to your AppDelegate class on iOS, or to your MainActivity class on Android, before calling Forms.Init: Prerequisites Visual Studio…
Configuring Push Notifications For Xamarin Forms
How to configure in your Xamarin Forms project the push notification for iOS and Android
New Xamarin Application Developed to Track and Manage COVID-19 in Real-time
Volunteers re-engineer cancer treatment software to monitor coronavirus pandemic using Microsoft’s Xamarin mobile framework with Azure Mobile Angel has released a new mobile application built on the Xamarin platform to manage potential and at-risk coronavirus patients in real-time. The free application monitors patients in clinics across the country through self-reported symptoms and prioritizes them in a triage list based on fever and other symptoms. With built-in telemedicine features, clinic staff can directly monitor patients while reducing in-person visits and potential exposure. The application also aggregates reports across the country so…
Xamarin build error: defining a default interface method requires –min-sdk-version >= 24
I added to my project Xam.Plugins.Android.ExoPlayer and then I received this error: java/lang/Object;I)V: defining a default interface method requires –min-sdk-version >= 24 (currently 13) for interface methods: com.google.android.exoplayer2.Player$EventListener.onTimelineChanged : (Lcom/google/android/exoplayer2/Timeline;Ljava/lang/Object;I)V Looking around, I discovered that other people had the same issue and the problem sits in the Android Options in Project Properties. No Dex compiler was specified, select D8 Dex compiler in the Android project properties: In code: <AndroidDexTool>d8</AndroidDexTool> Happy coding!
GitHub Package Registry
GitHub Package Registry, a package management service that makes it easy to publish public or private packages next to your source code
Add a macOS project to your existing solution
With the new version of Xamarin, we can create apps for macOS. But how can I add a macOS project to my solution? I explain step by step what we have to do. Add new project The first step is to add a new project for macOS in your solution. Right-click on your solution and select Add New project… Now select from the list App under Mac and then Cocoa App. Then name your project, usually, we call this project with yourprojectname.macOS.
Get the Most Out of iOS 11 with Visual Studio Tools for Xamarin
Join Craig Dunn explains what’s new in iOS 11 and how to take advantage of the latest updates – from drag-and-drop for iPad to machine learning and more – 100% in .NET and Visual Studio. Whether you’re building new or updating existing Xamarin.iOS apps, you’ll see how to implement new frameworks, APIs, and UI features, walk-through code samples, get expert tips and tricks, so you can start shipping iOS 11-ready apps to your users. In this webinar, you’ll: Explore iOS 11 UI changes, including adapting to the iPhone X form…
Xamarin Forms: TranslateY (or other properties) for platform
Sometimes you need to change a value for a specific platform and this value is a Double, for example. I spent a couple of minutes to find a working code. <Label> <Label.TranslationY> <OnPlatform x:TypeArguments=”x:Double” Android=”-10″ /> </Label.TranslationY> </Label> Happy coding!
Enable and control iOS 11 Large Titles in Xamarin.Forms
Apple introduced with iOS 11 a new UI in particular for larger titles: if you open your email, you see at the top a large title. That sit in the Navigation Bar and can be scrolled away when more space is needed. We can enable large titles with a renderer. For this example, I only created a new project and added the following renderer in the iOS project under Renderers folder. You can easily add to all your solution the following renderer in your iOS project: using System; using YourProject.iOS.Renderers;…
UriBuilder in Xamarin Forms
In Xamarin Forms there is a native function called UriBuilder: it allow you to create a well-formed url. In my implementation, all parameters are in a Dictionary called parameters. Using Linq, I put in builder.Query only the parameters with a value. UriBuilder builder = new UriBuilder(yourUrl); Dictionary<string, string> parameters = new Dictionary<string, string>(); parameters.Add(“reference”, Reference); parameters.Add(“param1”, Param1); builder.Query = string.Join(“&”, parameters.Where(p => !string.IsNullOrWhiteSpace(p.Value)) .Select(p => string.Format(“{0}={1}”, Uri.EscapeDataString(p.Key), Uri.EscapeDataString(p.Value)))); return builder.ToString(); Happy coding!
Binding FormattedString for Xamarin Forms
Xamarin Forms doesn’t have a Label with a Bindable FormattedString. For example, if you want a bindable bold word in the middle of a sentence in a Label, it’s very hard to design it with common control. For that, I create my own component for that. LabelRenderer.cs using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Linq; using System.Runtime.CompilerServices; using Xamarin.Forms; namespace PSC.Controls { public class Label : Xamarin.Forms.Label { protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); UpdateFormattedTextBindingContext(); } protected override void OnPropertyChanged( [CallerMemberName] string propertyName = null) { base.OnPropertyChanged(propertyName); if (propertyName ==…
Xamarin Forms Repeater View
A ListView is a kind of repeater but isn’t always what I want. It’s surprising something like this isn’t included in the framework but making your own is fairly simple. namespace PSC.Controls { /// <summary> /// Repeater view. /// </summary> public class RepeaterView : StackLayout { /// <summary> /// The item template property. /// </summary> public static readonly BindableProperty ItemTemplateProperty = BindableProperty.Create( “ItemTemplate”, typeof(DataTemplate), typeof(RepeaterView), null, propertyChanged: (bindable, value, newValue) => Populate(bindable)); /// <summary> /// The items source property. /// </summary> public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create( “ItemsSource”, typeof(IEnumerable),…
Xamarin, no show images in the device but only in the simulator
In my project I have some images to display. The funny thing is I can see images in the simulator but not in a real device. Simulator iPhone (real device) Solution iPhone is case-sensitive and the name of your images must be specified correctly. iOS Simulator probably is not case-sensitive and then it displays images with every name.
Xamarin, Android and starting a service at device boot
In my previous post called Xamarin: how to Start an Application at Device Boot in Android, I explained how you can change your Android Xamarin’s project to launch your app at the device boot. It is a good start but my problem was a bit more complex. I want to create a background service to track the geolocation of a device. I googled a lot to find a solution without a great success. Then I started to implement my code with some tests. Finally, I found a good way and…
Xamarin: how to Start an Application at Device Bootup in Android
This tutorial will explain to stat an application while the Android device boot-up. For this, we need to listen to the BOOT_COMPLETED action and react to it. BOOT_COMPLETED is a Broadcast Action that is broadcast once, after the system has finished booting. You can listen to this action by creating a BroadcastReceiver that then starts your launch Activity when it receives an intent with the BOOT_COMPLETED action. Add this permission to your manifest In your Android.Manifest you must add thi permission: <uses-permission android:name=”android.permission.RECEIVE_BOOT_COMPLETED” /> Then open this file and…
Device name in Xamarin
Using Device Information Plugin for Xamarin and Windows, you have access to same information for a device: GenerateAppId: used to generate a unique Id for your app. Id: this is the device specific Id Device Model: get the model of the device Version: get the version of the Operating System If you want the device name, it’s not in this list. Then for that we can create our functions. IDevice interface First of all we have to create an interface, I call it IDevice. using System; namespace myApp.Interfaces { public…
Xamarin forms, UWP Windows 10 App, TitleBar and Status bar customization
Customize the title bar of your Universal App for Windows 10 is quite easy, but you need to write different code for PC and Mobile. The class that allows you to customize the title bar: when running on a PC is called TitleBar when running on a Mobile is called StatusBar Before to call the API you first need to check if it exists (true if you are running on that platform): //PC customization if (ApiInformation.IsTypePresent( “Windows.UI.ViewManagement.ApplicationView”)) { var titleBar = ApplicationView.GetForCurrentView().TitleBar; if (titleBar != null) { titleBar.ButtonBackgroundColor = Colors.DarkBlue;…
An error occurs with MobileCenter for Xamarin iOS
I added Microsoft Mobile Center to my project after creating the app there. On MobileCenter documentation you can know the Install Identifier for your application (MobileCenter documentation is here). System.Guid installId = MobileCenter.InstallId; This function is working fine if you have Android or iOS 10. With iOS less than 10 an error occurs: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx). and the StackTrace is similar to at System.Guid+GuidResult.SetFailure (System.Guid+ParseFailureKind failure, System.String failureMessageID, System.Object failureMessageFormatArgument, System.String failureArgumentName, System.Exception innerException) [0x00030] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.4.0.123/src/mono/mcs/class/referencesource/mscorlib/system/guid.cs:198 \n at System.Guid+GuidResult.SetFailure (System.Guid+ParseFailureKind failure, System.String failureMessageID)…
Xamarin Forms and Google Mobile Ads for iOS: update
In my previous post I explaind how to add on your application advertising. In those days Xamarin has removed from the Component Store the component called Google Mobile Ads for iOS. Now you have to install another component called Firebase AdMob for iOS. After installed this component you can see in your Output window a similar info without see an advert in your app: 2016-11-18 11:28:14.853 WordBankEasy.iOS[11103:2250070] <Google> You must set the rootViewController property of <GADBannerView: 0x1034702c0; frame = (-10 0; 320 50); clipsToBounds = YES; layer = <CALayer: 0x174e39d40>>…