sábado, 17 de septiembre de 2016

Fix for Xamarin.Android Binding: missing class error was raised while reflecting


Fix for Xamarin.Android Binding: missing class error was raised while reflecting

Since latest version of Xamarin.Android was released it force to use Java 8 for Xamarin.Android projects which introduced a new issue on some binding libraries while doing some internal reflection things this is solved very easy by adding the next node into your binding .csproj file

<PropertyGroup>
    <JavaOptions>$(JavaOptions) -noverify </JavaOptions>
 </PropertyGroup>

jueves, 4 de agosto de 2016

Xamarin.Forms: Add Credit/Debit Card Reader to you App with PayPal.Forms


Xamarin.Forms: Add Credit/Debit Card Reader to you App with PayPal.Forms





Hello today I'll show how easily is to add a card scanner into your Xamarin.Forms(Android, iOS) app with only a few lines of code using the PayPal.Forms Library.

First at all we need to add PayPal.Forms to all of your projects(Android, iOS and PCL-Forms) by searching for "PayPal.Forms" in nuget packages manager or running next command on a nuget packages console "Install-Package PayPal.Forms"



Second on our Android app we need to add a few lines of code for permissions and features inside our "AndroidManifest.xml"



VERY IMPORTANT FOR IOS 10 IF YOU WANT TO USE THE CAMERA FEATURES

Add "NSCameraUsageDescription" into you Info.plist file.
<key>NSCameraUsageDescription</key>
<string>We will use your camera to scan the credit card</string>

After this now we're able to configure PayPal.Forms init calls inside our MainActivity.cs(Android) and AppDelegate.cs(iOS)

Call just CrossPayPalManager.Init(); just after call Forms.Init ();

***NOTE: if you plan to use only card scanner you can use init PayPal Config as follow***


If the configuration is getting fine now we can use the scan method CrossPayPalManager.Current.ScanCard();


Optional Parameter:

CardIOLogo
-- PayPal: Display PayPal Logo in the Scanner Page
-- CardIO: Display CardIO Logo in the Scanner Page
-- None: Hide Brand Logo in the Scanner Page

Result Data:

-ScanCardResult
-- Status (SuccessfulCancelledError)
-- Card:
--- Scaned: Returns true if card was scanned or false if the card was input by hand by user
--- RedactedCardNumber: Give you the card number with next format **** **** **** 1234.
--- PostalCode: Give you the card postal code(if is requerid).
--- ExpiryYear: Give you the card expiry year.
--- ExpiryMonth: Give you the card expiry month.
--- Cvv: Give you the card cvv.
--- CardType (Unrecognized, Ambiguous, Amex, Jcb, Visa, Mastercard, Discover)
--- CardNumber: Give you the card number.
--- CardImage: Forms ImageSource with Scanned Card Image.

Hope that this can help you to create and awesome Forms app now i invite you to play with it and also remember that this lib also can help you to implement PayPal Mobile SDK Frameworks for more information and examples take a look to my PayPal.Forms repository on Github:

https://github.com/AlejandroRuiz/PayPal.Forms

In the future we will continue with this post series to allow you monetize your Xamarin.Forms easily Happy Code Devs