永发信息网

如何获取android设备id

答案:2  悬赏:30  手机版
解决时间 2021-03-02 10:02
如何获取android设备id
最佳答案
Android设备不同类型的识别设备ID。

· 唯一编号(IMEI,MEID,ESN,IMSI)

· MAC地址

· 序列号

· ANDROID_ID

唯一编号(IMEI,MEID,ESN,IMSI)

说明在以前,当Android设备均作为电话使用时,寻找唯一标识号比较简单:()可用于找到(取决于网络技术)手机硬件唯一的IMEI,MEID,ESN和IMSI编号。

TelephonyManager.getDeviceId

IMEI,MEID,ESN,IMSI的定义如下:

•IMEI(国际移动设备识别码)唯一编号,用于识别 GSM,WCDMA手机以及一些卫星电话(移动设备识别码)全球唯一编号,用于识别CDMA移动电台设备的物理硬件,MEID出现的目的是取代ESN号段(电子序列号)(电子序列号)唯一编号,用于识别CDMA手机(国际移动用户识别码)与所有GSM和UMTS网络手机用户相关联的唯一识别编号如需要检索设备的ID,在项目中要使用以下代码:

•MEID

•ESN

•IMSI
import android.telephony.TelephonyManager;

import android.content.Context;

String imeistring = null;

String imsistring = null;

{

TelephonyManager telephonyManager;

telephonyManager =

( TelephonyManager )getSystemService( Context.TELEPHONY_SERVICE );



imeistring = telephonyManager.getDeviceId();



imsistring = telephonyManager.getSubscriberId();

}
全部回答
我自己以前用的一个工具类,用到了uuid,给你一用吧 import java.io.file; import java.io.fileoutputstream; import java.io.ioexception; import java.io.randomaccessfile; import java.util.uuid; import android.content.context; public class installation { private static string sid = null; private static final string installation = "installation"; public synchronized static string id(context context) { if (sid == null) { file installation = new file(context.getfilesdir(), installation); try { if (!installation.exists()) writeinstallationfile(installation); sid = readinstallationfile(installation); } catch (exception e) { throw new runtimeexception(e); } } return sid; } private static string readinstallationfile(file installation) throws ioexception { randomaccessfile f = new randomaccessfile(installation, "r"); byte[] bytes = new byte[(int) f.length()]; f.readfully(bytes); f.close(); return new string(bytes); } private static void writeinstallationfile(file installation) throws ioexception { fileoutputstream out = new fileoutputstream(installation); string id = uuid.randomuuid().tostring(); out.write(id.getbytes()); out.close(); } } // 调用方法 // 获取标识 string serialnumber = ""; serialnumber = installation.id(mcontext); // 静态方法,直接调用
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
吃烧烤在吃冰淇淋能坏肚子吗
粮全其美手抓饼这个地址在什么地方,我要处理
1861年4月的某一天,赵烈文(曾国藩的幕僚)看到
鱼缸闽江抽水泵为什么一会抽水一会停下来
赞香园烧烤这个地址在什么地方,我要处理点事
鞋码上带着cn21是什么意思
叫 豪杰 的男孩,应该取什么英文名字。给个建
化学药品乙酸酐变黄了,还能用吗?为什么会变
远东宏信明瑞(上海)船舶租赁有限公司在哪里啊
安阳市文峰区大营村今年拆迁吗
南瓜蒸多久能熟
佳奇超市(莲下分店)地址在哪,我要去那里办事
感谢两个字用数字怎么说
下图表示叶绿体中色素吸收光能的情况。根据此
滕州市嘉庆粮蔬种植专业合作社在什么地方啊,
推荐资讯
当x大于等于1时,x-1的绝对值等于多少
2015款奔腾个性版是什么意思
太自信怎么办
汉语越南语即时翻译
8括号x-3括号的立方加5=130
通过担保公司贷款买车需要注意什么事项
飞机票真假在哪里可以查询??
河北康利源医药药材有限责任公司外埠市场部我
proscenic扫地机器人型号902和cocostart哪个
又有个问题 也是单元格里面的0怎样去掉且不影
为什么苏宁电器年度报表上用“合并及公司&
江淮同悦1.8RS油耗多少?
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?