新手,求助mono

手抓宝 2013-06-20 10:04:43
新手一枚,目前用C#,求mono for andriod读取设备(只读取平板,不包括手机)的序列号、IMEI、MAC等内容,如何下手,请大神指教。
...全文
73 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
手抓宝 2013-06-20
  • 打赏
  • 举报
回复
谢大神,我用其他的方法解决了,你的我试了,好使。

string deviceid = TelephonyManager.FromContext(inflater.Context).DeviceId;
q107770540 2013-06-20
  • 打赏
  • 举报
回复
 /// <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;

        }

 

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧