title: Xamarin: How to get a phone number?
body: <p>I'm writing a test application, on the xamarin for the android. You need to know the phone number. I tried a lot of options. Last:</p>
  
  <pre><code>        [assembly: Xamarin.Forms.Dependency(typeof(PhoneNumberService))]
      public string GetMyPhoneNumber()
      {
          TelephonyManager mgr = Application.Context.GetSystemService(Context.TelephonyService) as TelephonyManager;
          return mgr.Line1Number;
      }
  </code></pre>
  
  <p>AssemblyInfo.cs:</p>
  
  <pre><code>&lt;`uses-permission android:name="android.permission.READ_PHONE_STATE"/&gt;`
  </code></pre>
  
  <p>AndroidManifest.xml:</p>
  
  <pre><code> [assembly: UsesPermission(Android.Manifest.Permission.ReadPhoneState)]
  </code></pre>
  
  <p>On the emulator works well on the phone does not work. Returns an empty string.</p>
  
  <p>How to get a phone number?</p>