新手一枚,目前用C#,求mono for andriod读取设备(只读取平板,不包括手机)的序列号、IMEI、MAC等内容,如何下手,请大神指教。

解决方案 »

  1.   

     /// <summary>        /// Retrieve the IMEI from the TelephonyManager        /// </summary>        /// <param name="context"></param>        /// <returns></returns>        public static string GetDeviceId(Context context)        {            TelephonyManager telephonyMgr =
    context.GetSystemService(Context.TelephonyService) as TelephonyManager;            string deviceId = telephonyMgr.DeviceId == null ? "UNAVAILABLE"
    : telephonyMgr.DeviceId;             return deviceId;        }         /// <summary>        /// Retrieve the PhoneNumber from the TelephonyManager        /// </summary>        /// <param name="context"></param>        /// <returns></returns>        public static string GetPhoneNumber(Context context)        {            TelephonyManager telephonyMgr =
    context.GetSystemService(Context.TelephonyService) as TelephonyManager;            string phoneNumber = telephonyMgr.Line1Number == null ?
    "UNAVAILABLE" : telephonyMgr.Line1Number;             return phoneNumber;        } 
      

  2.   

    http://stackoverflow.com/questions/15447937/getting-imei-of-a-phone
      

  3.   

    谢大神,我用其他的方法解决了,你的我试了,好使。string deviceid = TelephonyManager.FromContext(inflater.Context).DeviceId;