Posts

Showing posts from August, 2015

Authentication by Xamarin.Auth in Xamarin.Forms

Image
We always encounter the need for authentication in most of our applications. It's a struggling process to authenticate the user by interacting with services like Twitter, Facebook and so on. Here I'm creating a simple method of authentication using  Xamarin.Auth.  The Xamarin.Auth component is a great time saver for authentication. The authentication cardinals are given for authentication. Authenticators are responsible for managing the user interface and communicating with authentication services. Authenticators take a variety of parameters, like the Client ID, its authorization scope, the authorization URL, redirect URL and so on, since it varies depending on the authenticators. var  auth  =  new  OAuth2Authenticator   (   clientId: "", // your OAuth2 client id   scope: "", // the scopes for the particular API you're accessing, delimited by "+" symbols   authorizeUrl: new Uri(""), // the aut

Remove Android Action Bar Icon in Xamarin.Forms

Image
In this article we are creating a custom control renderer for Xamarin.Forms allowing developers to override the default native rendering of a Xamarin.Forms control with their own platform-specific code. We have seen many Xamarin related forums having a strong discussion about removing the action bar icon from an Android project in Xamarin.Forms. Many of them suggest making the application icon as transparent by altering the MainActivity.cs in Android project somewhat like the following: [Activity (Label = "Sample Application", Icon = "@android:color/transparent", MainLauncher = true] In this condition no one notices that by altering like this they are making the application icon to be transparent. As a result the application will not show an icon when it is installed on a device. Today we are showing a way to render your page so that you will be able to remove the unwanted action bar icon depending on your needs. Here I'm going to render the Navigat

Barcode Scanner Using Xamarin.Forms

Image
For creating a Barcode Scanner, I will use the NuGet package  Arc.BarCodes , a cross-platform creator built on top of ZXing.Net.Mobile to allow for easy cross-platform access from Shared/PCL core libraries. Now we can set some permissions for Android and Windows to get access to the camera. This is for taking the clear picture of the barcode that we want to scan. For Android open the  AndroidManifest.xml  and select  CAMERA  from the  Required Permissions . Now open  WMAppManifest.xml  for setting permissions to Windows Phone then select ID_CAP_ISV_CAMERA  from  Capabilities . Now we want to initialize the corresponding NuGet package in each platform-specific startup classes. For example, AppDelegate.cs for iOS, MainActivity.cs for Android and MainPage.xaml.cs for Windows Phone by calling  global::Acr.BarCodes.BarCodes.Init();  before calling  LoadApplication();  Now create a button on the page for the Barcode Scanner. Write the following code in the click event of the butto