title: Xamarin Android 9.0 GetImei error Java.Lang.SecurityException: getImeiForSlot android.permission.READ_PHONE_STATE
body: <p>I try to get my <code>unique ID</code> <code>IMEI</code> for <code>Android 9.0 API LVL 28</code></p>
  
  <p>When i tried with my code i have this error :</p>
  
  <blockquote>
    <p>Java.Lang.SecurityException: getImeiForSlot: Neither user 10154 nor current process has android.permission.READ_PHONE_STATE.</p>
  </blockquote>
  
  <pre><code>        public class DeviceInfo : IDeviceInfo
          {
              TelephonyManager telephonyManager;
              public DeviceInfo()
              {
                  telephonyManager = 
       (TelephonyManager)Application.Context.GetSystemService(Context.TelephonyService);          
              }
  
              public string Id
              {
                  get
                  {
                      telephonyManager = (TelephonyManager)Application.Context.GetSystemService(Context.TelephonyService);
                      if (Build.VERSION.SdkInt &gt;= BuildVersionCodes.O)
                          // TODO: Some phones has more than 1 SIM card or may not have a SIM card inserted at all
                          return telephonyManager.GetMeid(0);
                      else
      #pragma warning disable CS0618 // Type or member is obsolete
                          return telephonyManager.DeviceId;
      #pragma warning restore CS0618 // Type or member is obsolete
                  }
              }
  </code></pre>
  
  <p>and my androdManifest.xml </p>
  
  <pre><code>&lt;uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission android:name="android.permission.CAMERA" /&gt;
  &lt;uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" /&gt; 
  &lt;uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"/&gt;
      &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
    &lt;uses-permission android:name="android.permission.VIBRATE" /&gt;
  </code></pre>