安卓 檢視配置資訊

2021-10-01 10:06:00 字數 2546 閱讀 3016

配置資訊:

專案的配置資訊

手機的配置資訊

使用的時候建議封裝成單例的工具類

//專案的配置資訊

}if (singleton == null) }}

return singleton;

}private context context;

//裝置資訊初始化

public void init(context context)

public string getpackname() catch (packagemanager.namenotfoundexception e)

return context.getpackagename();

}public string getversionname() catch (packagemanager.namenotfoundexception e)

return "";

}public string getversioncode() catch (packagemanager.namenotfoundexception e)

return "";

}}

deviceinfoconfig:

private static volatile deciceinfoconfig singleton;

private deciceinfoconfig()

public static deciceinfoconfig getinstance() }}

return singleton;

}private context context;

//裝置資訊初始化

public void init(context context)

public deciceinfoconfig(context context)

//廠商

public string getmanufacturer()

//機型資訊

public string getmode()

public string getdevice()

//機型資訊

public int getcodename()

//裝置號 gsm——imei cdma——meid

@requiresapi(api = build.version_codes.m)

public string getid()else

return getimei();

}return null;

}// /**

// * android 5.0之前使用

// * @param slotid

// * @return

// */

// private string getimei(int slotid)

// logutils.d("getimei imei: "+ imei);

// return imei;

// }

// } catch (exception e)

// return "";

// }

//// /**

// * android 5.0之前使用

// * @return

// */

// private string getmeid()

// } catch (exception e)

// return "";

// }

//gms——imei

@requiresapi(api = build.version_codes.m)

private string getimei() )

string imei = systemservice.getdeviceid(telephonymanager.phone_type_gsm);

return imei;

}// cdma——meid

@requiresapi(api = build.version_codes.m)

private string getmeid() )

string meid = systemservice.getdeviceid(telephonymanager.phone_type_cdma);

return meid;

}//utdid(um的)

public string getutdid()

//實體地址(um的)

public string getmacaddress()

//螢幕解析度

public string getdisplay()

@suppresslint("missingpermission")

public string getlocation()

git config 檢視配置資訊

config 配置指令 1 git config config 配置有system級別 global 使用者級別 和local 當前倉庫 三個 設定先從system global local 底層配置會覆蓋頂層配置 分別使用 system global local 可以定位到配置檔案 檢視系統con...

檢視LINUX 硬體配置資訊

dmidecode more dmesg more 這2個命令出來的資訊都非常多,所以建議後面使用 more 便於檢視 2.檢視cpu資訊 方法一 linux下cpu相關的引數儲存在 proc cpuinfo 檔案裡 cat proc cpuinfo more 方法二 採用命令 dmesg grep...

Git檢視本地配置資訊

config 配置指令 git configconfig 配置有system級別 global 使用者級別 和local 當前倉庫 三個 設定先從system global local 底層配置會覆蓋頂層配置 分別使用 system global local 可以定位到配置檔案 檢視系統config...