资源预览内容
第1页 / 共7页
第2页 / 共7页
第3页 / 共7页
第4页 / 共7页
第5页 / 共7页
第6页 / 共7页
第7页 / 共7页
亲,该文档总共7页全部预览完了,如果喜欢就下载吧!
资源描述
AndroidBuild1. 越Build.BOARD/主板2. Build.BRAND/android系统定制商3. Build.CPU_ABI/cpu指令集4. Build.DEVICE/设备参数5. Build.DISPLAY/显示屏参数6. Build.FINGERPRINT/硬件名称7. Build.HOST8. Build.ID/修订版本列表9. Build.MANUFACTURER/硬件制造商10. Build.MODEL/版本11. Build.PRODUCT/手机制造商12. Build.TAGS/描述build的标签13. Build.TIME14. Build.TYPE/builderDO15. Build.USERimportjava.io.BufferedReader;importjava.io.FileNotFoundException;importjava.io.FileReader;importjava.io.IOException;importjava.io.ObjectInputStream.GetField;importandroid.Manifest;importandroid.app.Activity;importandroid.app.ActivityManager;importandroid.app.ActivityManager.MemoryInfo;importandroid.content.Context;importandroid.content.pm.PackageManager;importandroid.net.ConnectivityManager;importandroid.net.NetworkInfo;importandroid.os.Build;importandroid.telephony.TelephonyManager;importandroid.util.Log;publicclassPhoneInfoprivatestaticfinalStringTAG=PhoneInfo.class.getSimpleName();privatestaticfinalStringFILE_MEMORY=/proc/meminfo;privatestaticfinalStringFILE_CPU=/proc/cpuinfo;publicStringmIMEI;publicintmPhoneType;publicintmSysVersion;publicStringmNetWorkCountryIso;publicStringmNetWorkOperator;publicStringmNetWorkOperatorName;publicintmNetWorkType;publicbooleanmIsOnLine;publicStringmConnectTypeName;publiclongmFreeMem;publiclongmTotalMem;publicStringmCupInfo;publicStringmProductName;publicStringmModelName;publicStringmManufacturerName;privatePhoneInfo()publicstaticStringgetIMEI(Contextcontext)TelephonyManagermanager=(TelephonyManager)context.getSystemService(Activity.TELEPHONY_SERVICE);/checkifhasthepermissionif(PackageManager.PERMISSION_GRANTED=context.getPackageManager().checkPermission(Manifest.permission.READ_PHONE_STATE,context.getPackageName()returnmanager.getDeviceId();elsereturnnull;publicstaticintgetPhoneType(Contextcontext)TelephonyManagermanager=(TelephonyManager)context.getSystemService(Activity.TELEPHONY_SERVICE);returnmanager.getPhoneType();publicstaticintgetSysVersion()returnBuild.VERSION.SDK_INT;publicstaticStringgetNetWorkCountryIso(Contextcontext)TelephonyManagermanager=(TelephonyManager)context.getSystemService(Activity.TELEPHONY_SERVICE);returnmanager.getNetworkCountryIso();publicstaticStringgetNetWorkOperator(Contextcontext)TelephonyManagermanager=(TelephonyManager)context.getSystemService(Activity.TELEPHONY_SERVICE);returnmanager.getNetworkOperator();publicstaticStringgetNetWorkOperatorName(Contextcontext)TelephonyManagermanager=(TelephonyManager)context.getSystemService(Activity.TELEPHONY_SERVICE);returnmanager.getNetworkOperatorName();publicstaticintgetNetworkType(Contextcontext)TelephonyManagermanager=(TelephonyManager)context.getSystemService(Activity.TELEPHONY_SERVICE);returnmanager.getNetworkType();publicstaticbooleanisOnline(Contextcontext)ConnectivityManagermanager=(ConnectivityManager)context.getSystemService(Activity.CONNECTIVITY_SERVICE);NetworkInfoinfo=manager.getActiveNetworkInfo();if(info!=null&info.isConnected()returntrue;returnfalse;publicstaticStringgetConnectTypeName(Contextcontext)if(!isOnline(context)returnOFFLINE;ConnectivityManagermanager=(ConnectivityManager)context.getSystemService(Activity.CONNECTIVITY_SERVICE);NetworkInfoinfo=manager.getActiveNetworkInfo();if(info!=null)returninfo.getTypeName();elsereturnOFFLINE;publicstaticlonggetFreeMem(Contextcontext)ActivityManagermanager=(ActivityManager)context.getSystemService(Activity.ACTIVITY_SERVICE);MemoryInfoinfo=newMemoryInfo();manager.getMemoryInfo(info);longfree=info.availMem/1024/1024;returnfree;publicstaticlonggetTotalMem(Contextcontext)tryFileReaderfr=newFileReader(FILE_MEMORY);BufferedReaderbr=newBufferedReader(fr);Stringtext=br.readLine();Stringarray=text.split(s+);Log.w(TAG,text);returnLong.valueOf(array1)/1024;catch(FileNotFoundExceptione)e.printStackTrace();catch(IOExceptione)e.printStackTrace();return-1;publicstaticStringgetCpuInfo()tryFileReaderfr=newFileReader(FILE_CPU);BufferedReaderbr=newBufferedReader(fr);Stringtext=br.readLine();Stringarray=text.split(:s+,2);for(inti=0;iarray.length;i+)Log.w(TAG,+arrayi);Log.w(TAG,text);returnarray1;catch(FileNotFoundExceptione)e.printStackTrace();catch(IOExceptione)e.printStackTrace();returnnull;publicstaticStringgetProductName()returnBuild.PRODUCT;publicstaticStringgetModelName()returnBuild.MODEL;publicstaticStringgetManufacturerName()returnBuild.MANUFACTURER;publicstaticPhoneInfogetPhoneInfo(Contextcontext)PhoneInforesult=newPhoneInfo();result.mIMEI=getIMEI(context);result.mPhoneType=getPhoneType(context);result.mSysVersion=getSysVersion();result.mNetWorkCountryIso=getNetWorkCountryIso(context);result.mNetWorkOperator=getNetWorkOperator(context);result.mNetWork
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号