0
public string GetIdentifier()
        {

            Android.Telephony.TelephonyManager mTelephonyMgr;
            mTelephonyMgr = (Android.Telephony.TelephonyManager)Forms.Context.GetSystemService(Forms.Context.TELEPHONY_SERVICE);
            return mTelephonyMgr.DeviceId;
        }

Trying to get DeviceId through above code but TELEPHONY_SERVICE is giving compile time error in Visual Studio(Xamarin +Android).How to correct this? Please see the image attached for reference.ErrorImage

1 Answers1

2

Its a little different in Xamarin Android

        Android.Telephony.TelephonyManager mTelephonyMgr;
        mTelephonyMgr = (Android.Telephony.TelephonyManager)Forms.Context.GetSystemService(Android.Content.Context.TelephonyService);
        return mTelephonyMgr.DeviceId;
Adam
  • 16,089
  • 6
  • 66
  • 109