zoukankan      html  css  js  c++  java
  • android get uuid获取uuid

    https://github.com/Paldom/UniqueDeviceID

    protected void getDeviceUUID(){
            try {
                Context context = cordova.getActivity().getApplicationContext();
                TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    
                String uuid;
                String androidID = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
                String deviceID = tm.getDeviceId();
                String simID = tm.getSimSerialNumber();
    
                if ("9774d56d682e549c".equals(androidID) || androidID == null) {
                    androidID = "";
                }
    
                if (deviceID == null) {
                    deviceID = "";
                }
    
                if (simID == null) {
                    simID = "";
                }
    
                uuid = androidID + deviceID + simID;
                uuid = String.format("%32s", uuid).replace(' ', '0');
                uuid = uuid.substring(0, 32);
                uuid = uuid.replaceAll("(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})", "$1-$2-$3-$4-$5");
    
                this.callbackContext.success(uuid);
            }catch(Exception e ) {
                this.callbackContext.error("Exception occurred: ".concat(e.getMessage()));
            }
        }
  • 相关阅读:
    【每日日报】第四十六天
    jsp动作标识
    JSP注释
    request对象
    Servlet的创建和配置
    基于图书管理系统的浏览
    在JSP中应用JavaBean
    交流会
    基于图书管理系统的改
    基于图书管理系统的增
  • 原文地址:https://www.cnblogs.com/welhzh/p/5811180.html
Copyright © 2011-2022 走看看