Phoneswapshop Phoneswapshop - 1 year ago 231
C# Question

The name 'Console' does not exist in the current context In xamrian forms app

Hello I am working on a app in xamrian forms that needs to get the geolocation data from the device and then put the geolocation coordinates into the URL I am using the Geolocator plugin by James Montemagno and i'm using the code that the read me suggests, however I get the following error 4 times:

The name 'Console' does not exist in the current context

here's my code:

using AppName.Data;
using Xamarin.Forms;
using Plugin.Geolocator;

namespace AppName.Radar
public partial class RadarHome : ContentPage
public RadarHome()
var locator = CrossGeolocator.Current;
locator.DesiredAccuracy = 50;

var position = await locator.GetPositionAsync(timeout: 10000);

Console.WriteLine("Position Status: {0}", position.Timestamp);
Console.WriteLine("Position Latitude: {0}", position.Latitude);
Console.WriteLine("Position Longitude: {0}", position.Longitude);
var LatLong = position.Latitude + "," + position.Longitude;

var browser = new WebView();
browser.Source = "" + LatLong;

Content = browser;

I am using Visual Studio Update 3 any ideas on what i'm doing wrong?

Thanks in advance :)

Answer Source

Since your code is in a PCL with a specific profile the System.Console ins't available.

Use Debug.WriteLine("Text here") instead, don't forget to add using System.Diagnostics;.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download