title: Xamarin Plugin.Geolocator not working
body: <p>I tried to get the current location of the user by using the following code in Shared Code Library.</p>
  
  <p><strong>Source of the project is available here at <a href="https://www.dropbox.com/s/3gkvs3wwrcdu3mx/Loco.zip?dl=0" rel="nofollow" title="Dropbox">Dropbox link</a></strong></p>
  
  <pre><code>using System;
  using System.Diagnostics;
  using Plugin.Geolocator;
  using Plugin.Geolocator.Abstractions;
  
  namespace SampleApp
  {
      public class LocationManager
      {
          private DateTimeOffset timestamp;
  
          private double latitude;
  
          private double longitude;
  
          IGeolocator locator;
  
          public LocationManager()
          {
              asyncInitLocation();
          }
  
          private async void asyncInitLocation()
          {
              try
              {
                  locator = CrossGeolocator.Current;
                  locator.DesiredAccuracy = 50;
  
                  if (locator.IsGeolocationEnabled)
                  {
                      var position = await locator.GetPositionAsync(timeoutMilliseconds: 20000);
                      timestamp = position.Timestamp;
                      latitude = position.Latitude;
                      longitude = position.Longitude;
                  }
                  else 
                  {
                      Debug.WriteLine("Geolocation is disabled!");
                  }
              }
              catch (Exception ex)
              {
                  Debug.WriteLine("Unable to get location, may need to increase timeout: " + ex);
              }
          }
  
          public DateTimeOffset getTimestamp()
          {
              return this.timestamp;
          }
  
          public double getLatitude()
          {
              return this.latitude;
          }
  
          public double getLongitude()
          {
              return this.longitude;
          }
  
          public void refresh()
          {
              asyncInitLocation();
          }
      }
  }
  </code></pre>
  
  <p>I am getting the below error. Google didn't help me!</p>
  
  <pre><code>Unable to get location, may need to increase timeout: System.NotImplementedException: This functionality is not implemented in the portable version of this assembly.  You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.
    at Plugin.Geolocator.CrossGeolocator.get_Current () &lt;0x52c7bb60 + 0x0003f&gt; in &lt;filename unknown&gt;:0 
    at SampleApp.LocationManager+&lt;asyncInitLocation&gt;c__async0.MoveNext () &lt;0x52c7ae60 + 0x000bf&gt; in &lt;filename unknown&gt;:0 
  </code></pre>
  
  <p><strong>Update:</strong> packages.config file looks like this</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;packages&gt;
    &lt;package id="Microsoft.Bcl" version="1.1.10" targetFramework="portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarintvos10+xamarinwatchos10+xamarinios10" /&gt;
    &lt;package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarintvos10+xamarinwatchos10+xamarinios10" /&gt;
    &lt;package id="Microsoft.Net.Http" version="2.2.29" targetFramework="portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarintvos10+xamarinwatchos10+xamarinios10" /&gt;
    &lt;package id="modernhttpclient" version="2.4.2" targetFramework="portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarintvos10+xamarinwatchos10+xamarinios10" /&gt;
    &lt;package id="Newtonsoft.Json" version="8.0.3" targetFramework="portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarintvos10+xamarinwatchos10+xamarinios10" /&gt;
    &lt;package id="Xam.Plugin.Geolocator" version="3.0.4" targetFramework="portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarintvos10+xamarinwatchos10+xamarinios10" /&gt;
  &lt;/packages&gt;
  </code></pre>
  
  <p>Now I get the below error message:</p>
  
  <pre><code>Unable to get location, may need to increase timeout: System.Threading.Tasks.TaskCanceledException: A task was canceled.
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0002d] in /Users/builder/data/lanes/3415/7db2aac3/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:179 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3415/7db2aac3/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3415/7db2aac3/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
    at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3415/7db2aac3/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:535 
    at Plugin.Geolocator.GeolocatorImplementation+&lt;GetPositionAsync&gt;d__27.MoveNext () [0x00597] in C:\projects\xamarin-plugins\Geolocator\Geolocator\Geolocator.Plugin.Android\GeolocatorImplementation.cs:175 
  --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3415/7db2aac3/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00027] in /Users/builder/data/lanes/3415/7db2aac3/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:176 
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3415/7db2aac3/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3415/7db2aac3/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
    at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3415/7db2aac3/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357 
    at BugsAndDrugs.LocationManager+&lt;asyncInitLocation&gt;c__async0.MoveNext () [0x000d4] in /Users/myname/Perforce/depot/test_sandbox/Playground/SampleApp/SampleApp/Manager/LocationManager.cs:32 
  </code></pre>
  
  <p>Am I missing something? I have added the plugins to the project using nuget.</p>