Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Cannot get SerialPortInfo through Intent Xamarin Forms

$
0
0

Hello guys!

I am extremely new to Xamarin Forms.

I am trying to connect to Serial Port through Android OS & I am using Xamarin Forms.

I found a project on BitBucket which uses a specific dll to communicate with the Serial Port. I have attached the project for you reference. The dll can be found in the debug folder of the same.

The sample project works flawlessly. However, since it was just an activity and had no UI, I had to create my own project with buttons to open and close the connection with the Serial Port.

I copied all the code from the sample project and added it to my app. However, the following line causes an error due to which I am not able to compile :

portInfo = Intent.GetParcelableExtra(EXTRA_TAG) as UsbSerialPortInfo;

This is the error - "An object reference is required for the non static field method or property Intent".

How can I resolve this error?

Thank You! :)


Viewing all articles
Browse latest Browse all 204402

Trending Articles