Posts

Showing posts with the label XAMARIN

[News] Microsoft acquire Xamarin !

Image
In its original blog post ( that you can find it here ), Scott Guthrie has announced that Microsoft acquired Xamarin, the company that gave us the technology to develop mobile apps in C# for  iOS, Android and WP :) Wednesday, February 24, 2016 In my mind it s a good news for the futur evolution of the technology, however we can ask ourself about the futur development and pricing strategies... Hope it will be more accessible, at less in term of pricing, than the actual version ! What do you think ?

Android Ad-Hoc app publication guide (with Xamarin Studio)

Image
Warning before to start Before to install a custom APK app on your device, make sure it comes from a secured and trusted source ! Generate your APK using Xamarin Studio In order to have a valid package file (APK file), we have to generate a valid package signed with a security certificate. You can use a temporary certificate for test purpose. The process bellow shows you how to do that using Xamarin Studio Wizard: Generate your APK Select Archive for publishing menu Then select "Ad-Hoc" option (to generate your APK localy) Click on "Sign and distribute" Create a custom signing certificate Create a temporary certificate to sign your APK file Install the APK on the target device Configure the target device In order to accept and install a "custom" APK (application coming from other sources than the Play Store), you will need to unlock your phone. This is done in the phone's parameters

Xamarin.forms.Maps - Tap to get a position on the map...

Image
Xamarin.Forms.Map component Xamarin.Forms.Maps is a great component. It gives you the possibility to deal with maps and geolocation problematics in a few lines of code. This "Map" component internally use native map controls for iOS, Android and Windows Phone: You can display and locate "Pins" with custom information on the map. I suggest you to read the reference links above. Display pins with custom information The problem But actually, in my mind, the Map control miss a very important feature: --> Tap  on the map to get the relative location (to put a new pin, to get the relative address...) The workaround Use renderers Actually, to solve this problem, we need to implement custom renderers for iOS and Android. Maybe this feature will be implemented later by Xamarin... So here is my solution (3 code files below): - ExtMap.cs : overloaded map control that will contain our "Tapped" event to get the tapped location

VS2013 Xamarin's incompatible plugin when installing VS2015...

Image
As a good .NET developer, yesterday I installed the new Visual Studio 2015 IDE to discover all its new features... VS2015 installed ! I was previously developping mobile apps with Xamarin on VS2013. So as I am impatient I installed VS2015 without thinking of all the modifications it can bring to my environment... And bingo ! When I started back VS2013 to edit my Xamarin's projects, I had a bad surprise: iOS & Android projects no more compatible... But, fortunately, I find a really quick solution to restore Xamarin compatibility with VS2013. In fact in the windows programs / functionnalities menu, I  changed the Xamarin app components configuration like above: Xamarin, change installation Xamarin for Visual Studio 2013 is disabled ! Re-enable it and it s all good :) And go you can continue to develop Xamarin projects with VS2013 !

[Xamarin Forms] Button text alignment issue in Android

Image
Recently, I had to deal with custom Buttons in my Android application. So I designed custom renderers to render it. Unfortunately, I encountered a strange behavior with the text alignment of my buttons. This happens when the button changes of state : - Originally the button's text is centered - When you click it, the text moves to the left See images below:   Before / after the button click After investigating, I found a solution to my problem. In my Android custom button renderer, I had to overwrite a specific method:  ChildDrawableStateChanged public class ExtButtonRenderer : ViewRenderer<Extbutton, global::android.widget.button> { ... public override void ChildDrawableStateChanged(Android.Views.View child) { base.ChildDrawableStateChanged(child); if (Control != null) Control.Text = Control.Text; } ... } That's all ! Related links: Custom renderers: http://developer.xamarin.com/guides

[Xamarin Forms] Embed custom fonts in your apps

Image
Recently I had some difficulties to embed custom fonts in my applications. Specially with the iOS application that was crashing with no message (while it was working for the Android version). In fact, it was a font issue. So in this post I will show you some tips to embed quickly custom fonts in both your Android & iOS apps. 1- Select your fonts The first step is to get some cool fonts you want to use. You'll maybe use (free) fonts from various websites like: www.1001freefonts.com www.dafont.com 2- Set font files properties In your solution, include your fonts files: iOS:  Create a subfolder (in the the 'Resources' directory) where to embed the fonts Build Action = BundleResource & "Copy Always" Android : Create a subfolder in the 'Assets' directory where to embed the fonts: Build Action = "AndroidAsset" & "Copy Always" 3- iOS application: edit your plist file With iOS you need to specify the e

[TIP] "Dispatcher.BeginInvoke()" in Xamarin.Forms

In traditional WP8 apps, when you want to update a visual element but you are not in the UI thread, you have to use the dispatcher like this: Deployment.Current.Dispatcher.BeginInvoke( /* my custom task */); In Xamarin.Forms, you have to use the Device 's object static method: Device.BeginInvokeOnMainThread(() => { // your code on UI thread here... });

Microsoft Band SDK available

Image
Today, I would like to remember you that the Microsoft Band SDK is now available for developers ! You can also find the associated Xamarin component for iOS & Android platforms. Here are the links: Xamarin Microsoft Band component for iOS & Android Microsoft Band SDK download page With this SDK you can access the following band sensors: Accelerometer : Provides X, Y, and Z acceleration in meters per second squared (m/s2) units. Gyroscope Provides X, Y, and Z angular velocity in degrees per second (°/sec) units. Distance : Provides the total distance in centimeters, current speed in centimeters per second (cm/s), current pace in milliseconds per meter (ms/m), and the current pedometer mode (such as walking or running). Heart Rate  Provides the number of beats per minute, also indicates if the heart rate sensor is fully locked onto the wearer’s heart rate. Pedometer  Provides the total number of steps the wearer has taken. Skin Temperature Provides t

Xamarin.Forms device unique ID...

As in a lot of applications, you will probably need to get a unique identifier to identify a unique user . And it becomes a little more complicated when you have to deal with different platforms like Android, iOS and Windows Phone... Here is a simple solution that you can implement in Xamarin Forms that I found on this blog: http://codeworks.it/blog/?p=260 First define a service that you will use in your Xamarin Forms Application: // Your service interface definition public interface IDevice { string GetIdentifier(); } // How you get your service in your app IDevice device = DependencyService.Get (); string deviceIdentifier = device.GetIdentifier(); And here are the implementations for Android / Windows Phone and the most complicated, iOS platform: // WINDOWS PHONE [assembly: Xamarin.Forms.Dependency(typeof(WinPhoneDevice))] namespace XFUniqueIdentifier.WinPhone { public class WinPhoneDevice : IDevice { public string GetIdentifier() { byte[] myDeviceId = (

Xamarin & Caliburn.Micro

Good news for Caliburn.Micro users: it is now ( almost ) compatible with xamarin! http://caliburnmicro.com/announcements/xamarin/

Xamarin.Forms: Picker control and "Items" binding problem...

Image
If I tell you "ComboBox", you will see quickly of which control I'm talking about. There no control named "ComboBox" in Xamarin.Forms but if you search a little, you will find the "Picker " control. Class: Xamarin.Forms.Picker In the namespace: Xamarin.Forms Doc link : http://iosapi.xamarin.com/index.aspx?link=T%3AXamarin.Forms.Picker The problem is that you cannot bind directly "Picker.Items" property in the XAML file ! For that you have to use the code behind file. xaml (doesn't work): <Picker Items="{Binding MyViewModelList}"... /> So what do we have to do ? 1- Name your "Picker" control in the xaml file (by adding an attribute like x:Name="uiPicker" ) 2- On the parent page in code behind, override the "OnBindingContextChanged( )" method 3- In this method, fill your "Picker.Items" property from your viewmodel's values. 4- On the XAML file, you can onl

Add Xamarin.Forms intellisense to VS2013

Image
Actually we can edit 'XAML' Xamarin forms but we don't have access to the designer. And more there is no auto-completion available. Hopefully there is a way to add it ! (ref: http://www.cazzulino.com/mobileessentials.html) In Visual Studio: Options\Extensiosn and Updates, add the following entry: http://gallery.mobileessentials.org/feed.atom Then you will have access to the following extension: You are ready to code in XAML !