`
shendixiong
  • 浏览: 393078 次
  • 性别: Icon_minigender_1
  • 来自: 长沙
社区版块
存档分类
最新评论

android 获取 mac 以及device id

阅读更多

因为在工作中要统计一些用户的数据,以及爱好等等..所以就要统计不同用户!所以,刚开始用device id 如下:/**

     * 获取机器唯一标识
     * @param _context
     * @return
     */
    public String getLocaldeviceId(Context _context){
        TelephonyManager tm = (TelephonyManager) _context
                .getSystemService(Context.TELEPHONY_SERVICE);
        String deviceId = tm.getDeviceId();
        if (deviceId == null
                || deviceId.trim().length() == 0) {
            deviceId = String.valueOf(System
                    .currentTimeMillis());
        }
        return   deviceId ;
    }

  我理解为类似手机的出厂标号,但是有很多的是无法获取到device id的!所以,就要获取mac地址

     mac地址很好理解,就是用户上网的上网许可证,这个买手机的时候,你翻开电池就知道里面有一个标签!

 

下面是获取mac地址的代码

 

/**
     * 获取mac地址
     * @param context
     * @return
     */
    public String getLocalMacAddress(Context context) {
        WifiManager wifi = (WifiManager) context.getSystemService(
                Context.WIFI_SERVICE);
        WifiInfo info = wifi.getConnectionInfo();
        return info.getMacAddress();
    }
 
分享到:
评论

相关推荐

    Device ID apk

    Device ID apk应用,可以方便查看Android手机的 Device ID、GSF ID、IMEI、SIM Subscriber ID、IP Address、WiFi Mac Address等

    详解Android获取设备唯一ID的几种方式

    先来看看几种比较单一的方式: IMEI 方式:TelephonyManager.getDeviceId(): 问题 范围:只能支持拥有通话功能的设备,对于平板不可以。 持久性:返厂,数据擦除的时候不彻底,...ANDROID_ID 2.2(Froyo,8)版本

    浅谈android获取设备唯一标识完美解决方案

    * deviceID的组成为:渠道标志+识别符来源标志+hash后的终端识别符 * * 渠道标志为: * 1,andriod(a) * * 识别符来源标志: * 1, wifi mac地址(wifi); * 2, IMEI(imei); * 3, 序列号(sn); ...

    platform_device_id:Flutter插件获取设备ID

    platform_device_id 从android,ios,windows,linux,mac获取设备ID描述视窗BIOS UUID例如99A4D301-53F5-11CB-8CA0-9CA39A9E1F01 Linux BIOS UUID例如32a70060-2a39-437e-88e2-d68e6154de9f 苹果IOPlatformUUID例如...

    Android 手机无法连接mac解决办法

    1.关于本机–>更多信息->概系统览->系统报告->usb->你所连接的device–>供应商ID(Vendor ID) 2.终端执行如下命令:  echo 0x2717 >> ~/.android/adb_usb.ini 3.重启 adb 去DDMS 看看 有啦!! 从而解决了小米2...

    Delphi跨平台(Win,Android,IOS)获取设备唯一标识符

    Delphi跨平台(Win,Android,IOS)获取设备唯一标识符ios,android,mswindows获取设备唯一标识符和mac地址。

    getid:获取设备 ID、SIM 序列号、IMEI、IMSI、Google 服务密钥、Android 的 WiFi Mac 地址

    获取设备 ID、SIM 序列号、IMEI、IMSI、Google 服务密钥、Android 的 WiFi Mac 地址无需互联网连接 获取详细信息: ★Device ID ★SIM SerialNumber ★IMEI ★IMSI ★Google Service Key ★WiFi Mac address 这是...

    新版Android开发教程.rar

    ----------------------------------- Android 编程基础 1 封面----------------------------------- Android 编程基础 2 开放手机联盟 --Open --Open --Open --Open Handset Handset Handset Handset Alliance ...

    developing android application with adobe air.part1

    Installing the AIR Runtime on an Android Device What Is in the AIR SDK New ActionScript Libraries AIR on the Desktop Versus AIR on Android Mobile Flash Player 10.1 Versus AIR 2.6 on Android Chapter 2 ...

    developing android application with adobe air.part4.rar

    Installing the AIR Runtime on an Android Device What Is in the AIR SDK New ActionScript Libraries AIR on the Desktop Versus AIR on Android Mobile Flash Player 10.1 Versus AIR 2.6 on Android Chapter 2 ...

    developing android application with adobe air.part3.rar

    Installing the AIR Runtime on an Android Device What Is in the AIR SDK New ActionScript Libraries AIR on the Desktop Versus AIR on Android Mobile Flash Player 10.1 Versus AIR 2.6 on Android Chapter 2 ...

    developing android application with adobe air.part2.rar

    Installing the AIR Runtime on an Android Device What Is in the AIR SDK New ActionScript Libraries AIR on the Desktop Versus AIR on Android Mobile Flash Player 10.1 Versus AIR 2.6 on Android Chapter 2 ...

    Mac中Eclipse连不上Android手机的解决方法

    Windows下Eclipse可以连接Device里能显示设备名称,但是在Mac OS X下的Eclipse Device始终不能显示连接。 解决方法: 1.把Android手机开启调试模式,然后连接在我们的Mac OS上。 2.选择Mac的 关于本机->更多信息-> ...

    全志A80平台固定以太网的MAC地址ethernet_a80_merrii_20151203_1607.7z

    Android的DeviceID的添加 找了好久,可以看见文件:/proc/cpuinfo中的CPU的ID号是唯一的。 测试:先刷美睿的系统,然后再刷原生的系统(支持4K录像,但是美睿没有移植驱动的系统),发现序列号没变。 序列号查看的...

    通过WIFI(不用数据线)连接Android手机调试

    Android开发中少不了真机调试,总用数据线插插拔拔的还是不方便也不稳定,其实可以实现WIFI的方式连接android手机。  1. 当然首先要打开WIFI,手机要和电脑在同一局域网内。  2. 在手机上安装AdbWireless(Google ...

    ChromeDriver v2.20 for windows linux and mac

    Resolved issue 1225: RESPONSE InitSession unknown error: Device <device_id> is not online [['OS-Android', 'Pri-0']] Resolved issue 960: ChromeDriver support to access WebView elements [['OS-All', 'Pri...

    蓝牙APP通信

    .findViewById(R.id.device_mac_txt); device_name_txt.setText(getItem(position).GetDevice().getName()); device_mac_txt.setText("Mac: " + getItem(position).GetDevice().getAddress()); ...

    解决Android studio中关于模拟器的/data目录不能显示的问题

    当我们在Android studio中打开Android device monitor时,发现data目录不能打开,如图: 当我们去点击/data/目录时,发现什么都没有,这是怎么回事呢? 原因是我们权限不够,当前的用户没有权限访问data目录。 1....

    adb1.0.26包含fastboot.exe

    ADB,即 Android Debug Bridge,它是 Android 开发/测试人员不可替代的强大工具,也是 Android 设备玩家的好玩具。 注:有部分命令的支持情况可能与 Android 系统版本及定制 ROM 的实现有关。 基本用法 命令语法 ...

    Android-Monkey-Adapter:它是android测试工具monkey running和crash-log-analyzing适配器的适配器

    AndroidMonkeyAdapter管理monkey作业并分析所有运行日志,以确定崩溃属于哪种异常 简介安装Android应用程序,运行Monkey测试... -d,--device-id < arg> the id list of the devices which is need to run monkey test

Global site tag (gtag.js) - Google Analytics