Android查询设备属性c/c++方法

在Android开发中,可以通过c接口直接获取设备属性,系统接口为:
int __system_property_get(const char* name, char* value);

作者: hybase@qq.com 微信: hybase

实现代码

下面是作者使用的常用属性

#include <sys/system_properties.h>typedef struct SDeviceInfo
{char szId[128];char szPlatform[128];char szHardware[128];char szBrand[128];char szManufacturer[128];char szCpuAbi[128];char szCpuAbiList[256];char szModel[128];char szDevice[128];char szBoard[128];
} SDeviceInfo;static SDeviceInfo g_devInfo;
__system_property_get("ro.build.id",             g_devInfo.szId);
__system_property_get("ro.hardware",             g_devInfo.szHardware);
__system_property_get("ro.board.platform",       g_devInfo.szPlatform);
__system_property_get("ro.product.brand",        g_devInfo.szBrand);
__system_property_get("ro.product.manufacturer", g_devInfo.szManufacturer);
__system_property_get("ro.product.cpu.abi",      g_devInfo.szCpuAbi);
__system_property_get("ro.product.cpu.abilist",  g_devInfo.szCpuAbiList);
__system_property_get("ro.product.model",        g_devInfo.szModel);
__system_property_get("ro.product.device",       g_devInfo.szDevice);
__system_property_get("ro.product.board",        g_devInfo.szBoard);

华为电视查询结果

[device_info_init] ro.build.id       : HUAWEIKANT-350S
[device_info_init] ro.board.platform : honghu818
[device_info_init] ro.hardware       : honghu8xx
[device_info_init] ro.product.brand  : HUAWEI
[device_info_init] ro.product.manufacturer: HUAWEI
[device_info_init] ro.product.cpu.abi: arm64-v8a
[device_info_init] ro.product.cpu.abilist: arm64-v8a,armeabi-v7a,armeabi
[device_info_init] ro.product.model  : KANT-350S
[device_info_init] ro.product.device : HWKANT-350S
[device_info_init] ro.product.board : KANT

ro.product 属性

* ro.product.brand   品牌客户名称,
* ro.product.model  终端用户可见的产品名称,可以有空格
* ro.product.manufacturer   产品/硬件的制造商名称
* ro.product.name   手机正式名称客户项目代号,不要有空格,如果包含空格,会导致Google账号无法登陆
* ro.product.board  采用的底板/处理器客户项目代号
* ro.product.device 采用的设备,作用范围:adb shell进去时显示的名称客户项目代号,不要有空格
* ro.build.product  已经过时,现在使用“ro.product.device”,等同于“ro.product.device”

Android 系统属性详情(创维电视案例)

下面是通过adb方式查询到的详情。供读者参考。

# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=LMY47V
ro.build.display.id=LMY47V.20181229 test-keys
ro.build.version.incremental=20181229
ro.build.version.sdk=22
ro.build.version.codename=REL
ro.build.version.all_codenames=REL
ro.build.version.release=5.1.1
ro.build.version.security_patch=2015-11-01
ro.build.version.base_os=
ro.build.date=Sat Dec 29 15:13:24 CST 2018
ro.build.date.utc=1546067604
ro.build.type=user
ro.build.user=www-data
ro.build.host=rjyby07
ro.build.tags=test-keys
ro.build.flavor=p351-user
ro.product.model=8A20 V8E
ro.product.brand=Skyworth
ro.product.name=p351
ro.product.device=p351
ro.product.board=p351
# ro.product.cpu.abi and ro.product.cpu.abi2 are obsolete,
# use ro.product.cpu.abilist instead.
ro.product.cpu.abi=armeabi-v7a
ro.product.cpu.abi2=armeabi
ro.product.cpu.abilist=armeabi-v7a,armeabi
ro.product.cpu.abilist32=armeabi-v7a,armeabi
ro.product.cpu.abilist64=
ro.product.manufacturer=Skyworth
ro.product.locale.language=zh
ro.product.locale.region=CN
ro.wifi.channels=11
ro.board.platform=gxbaby
# ro.build.product is obsolete; use ro.product.device
ro.build.product=p351
# Do not try to parse description, fingerprint, or thumbprint
ro.build.description=p351-user 5.1.1 LMY47V 20181229 test-keys
ro.build.fingerprint=Skyworth/p351/p351:5.1.1/LMY47V/20181229:user/test-keys
ro.build.characteristics=mbx,nosdcard
# end build properties
#
# from device/customer/p351/system.prop
#
#add for Coocaa5.x by liyang
init.svc.adbd=stopping
persist.sys.usb.config=mtp
ro.build.dev_owner=system
ro.build.3Dflag=0
ro.sf.lcd_density=240
ro.product.model=8A20 V8E
ro.product.brand=Skyworth
ro.product.manufacturer=Skyworth
ro.build.ccos.type=mix
ro.build.skymodel=8A20
ro.build.skytype=V8E
ro.build.skymid=T968
ro.build.skyversion.svn=default
ro.build.skyversion.tianci=default
persist.service.homepage.pkg=com.coocaa.homeshell
persist.service.homepage.cls=com.coocaa.homeshell.Activity
third.get.4k=1
third.get.h265=1
#SystemService set
third.get.mac=0
third.get.barcode=0
third.get.launcher.start=0
third.get.factory=0
third.get.facSingleKeyEnable=false
#add by liyang end#add by sunsikai for new start flow start
persist.get.facSingleKeyEnable=0
#add by sunsikai for new start flow end# Set display related config
ro.platform.has.mbxuimode=true
ro.platform.has.tvuimode=true
ro.platform.has.realoutputmode=truedebug.hwui.render_dirty_regions=false
#camera max to 720p
ro.camera.preview.MaxSize=1280x720
ro.camera.preview.LimitedRate=1280x720x30,640x480x30,320x240x28
ro.camera.preview.UseMJPEG=1persist.sys.fastboot=false
persist.sys.strictmode.disable=true#if wifi Only
ro.radio.noril=false#if need pppoe
ro.net.pppoe=true#Dolby DD+ decoder option
#for TV/IPTV need set RF drc mode by default
#if defined this prop,will overwrite the value of
#/sys/class/audiodsp/ac3_drc_control
#"CUSTOM_0","CUSTOM_1","LINE","RF"
ro.dolby.drcmode=3
#this prop to for videoplayer display the DD+/DD icon when playback
ro.platform.support.dolby=true
#DTS decoder option
#display dts icon when playback
ro.platform.support.dts=true
#DTS-HD support prop
#ro.platform.support.dtstrans=true
#ro.platform.support.dtsmulasset=true
#DTS-HD prop end
# Enable player buildin
media.amplayer.seekkeyframe=true
media.amsuperplayer.enable=true
media.amplayer.enable-acodecs=ac3,eac3,rm,dts
media.amplayer.enable=true
media.amsuperplayer.m4aplayer=STAGEFRIGHT_PLAYER
media.amsuperplayer.defplayer=PV_PLAYER
media.amplayer.thumbnail=true
media.amplayer.widevineenable=false
media.amplayer.dsource4local=1
media.amplayer.startmode=true
media.arm.audio.decoder=ape,flac,dts,ac3,eac3,wma,wmapro,mp3,aac,vorbis,raac,cook,amr,pcm,adpcm,aac_latm,rm
media.wfd.use-pcm-audio=false
media.wfd.videoresolution-type=1
media.wfd.videoresolution-group=0
media.wfd.videoframerate=24
media.wfd.video-bitrate=2000000
media.html5videowin.enable=1
media.decoder.vfm.defmap=decoder ppmgr deinterlace amvideo
media.dtv.running=1
const.bootanim.delay=2500
#add for not seek chinese track automaticly
audio.track.default.chinese=false
#add for video boot, 1 means use video boot, others not .
service.bootvideo=1
# default boot video volume
sys.bootvideo.vol=5# Define drm for this device
drm.service.enabled=1#used forward seek for libplayer
media.libplayer.seek.fwdsearch=1#fix dd test av sync
media.libplayer.fillzerothrsh=27000#disable slowsync
libplayer.slowsync.disable=true#fix hls sync
libplayer.livets.softdemux=1
libplayer.netts.recalcpts=1#map volume
ro.audio.mapvalue=0,0,0,0#add livhls,libcurl as default hls
media.libplayer.curlenable=true
media.libplayer.modules=vhls_mod,dash_mod,curl_mod,prhls_mod,vm_mod#add for chezhenwu
media.libplayer.show_firstframe=0#Hdmi In
ro.sys.hdmiin.enable=true
mbx.hdmiin.switchfull=false
mbx.hdmiin.videolayer=false#adb
service.adb.tcp.port=5555#switch different remote control
persist.sys.remoteid=0e#hdcp22_key control
persist.sys.hdcp22key=false#blutooth volume
persist.sys.T868.bluth.val=30
######## UBOOTENV VARIBLES - r/w as system properties ##########
#
#  Now we can load ubootenv varibles to system properties.
#  We use a special prefix ("ubootenv.var" as default) to indicate that the 'property'
#  actually is an ubootenv varible.
#
#  A ubootenv 'property' will be initialized during system booting. And when user set
#  a different value, it will be written back to ubootenv device immediately.
### prefix of ubootenv varibles - should less than 16 chars.
#UBOOTENV MTD NAME
#ubootenv.var.bootcmd=
#ubootenv.var.cpuclock=
#ubootenv.var.gpuclock=
#ubootenv.var.memsize=
#ubootenv.var.ethaddr=
#ubootenv.var.ipaddr=
#ubootenv.var.gatewayip=
ubootenv.var.outputmode=
#ubootenv.var.screenratio=
#ubootenv.var.oobeflag=
ubootenv.var.480p_x=
ubootenv.var.480p_y=
ubootenv.var.480p_w=
ubootenv.var.480p_h=
ubootenv.var.480i_x=
ubootenv.var.480i_y=
ubootenv.var.480i_w=
ubootenv.var.480i_h=
ubootenv.var.576p_x=
ubootenv.var.576p_y=
ubootenv.var.576p_w=
ubootenv.var.576p_h=
ubootenv.var.576i_x=
ubootenv.var.576i_y=
ubootenv.var.576i_w=
ubootenv.var.576i_h=
ubootenv.var.720p_x=
ubootenv.var.720p_y=
ubootenv.var.720p_w=
ubootenv.var.720p_h=
ubootenv.var.1080p_x=
ubootenv.var.1080p_y=
ubootenv.var.1080p_w=
ubootenv.var.1080p_h=
ubootenv.var.1080i_x=
ubootenv.var.1080i_y=
ubootenv.var.1080i_w=
ubootenv.var.1080i_h=
ubootenv.var.4k2k24hz_x=
ubootenv.var.4k2k24hz_y=
ubootenv.var.4k2k24hz_w=
ubootenv.var.4k2k24hz_h=
ubootenv.var.4k2k25hz_x=
ubootenv.var.4k2k25hz_y=
ubootenv.var.4k2k25hz_w=
ubootenv.var.4k2k25hz_h=
ubootenv.var.4k2k30hz_x=
ubootenv.var.4k2k30hz_y=
ubootenv.var.4k2k30hz_w=
ubootenv.var.4k2k30hz_h=
ubootenv.var.4k2k50hz_x=
ubootenv.var.4k2k50hz_y=
ubootenv.var.4k2k50hz_w=
ubootenv.var.4k2k50hz_h=
ubootenv.var.4k2k60hz_x=
ubootenv.var.4k2k60hz_y=
ubootenv.var.4k2k60hz_w=
ubootenv.var.4k2k60hz_h=
ubootenv.var.4k2ksmpte_x=
ubootenv.var.4k2ksmpte_y=
ubootenv.var.4k2ksmpte_w=
ubootenv.var.4k2ksmpte_h=
ubootenv.var.digitaudiooutput=
ubootenv.var.defaulttvfrequency=
ubootenv.var.has.accelerometer=
ubootenv.var.cecconfig=
ubootenv.var.cvbsmode=
ubootenv.var.hdmimode=
ubootenv.var.is.bestmode=
ubootenv.var.disp.fromleft=
ubootenv.var.edid.crcvalue=## p351 control uboot env
ubootenv.var.firstboot=
ubootenv.var.ipaddr=
ubootenv.var.gatewayip=
ubootenv.var.suspend=
ubootenv.var.ubootversion=
ubootenv.var.usbboot=
#disable panel rotate
ubootenv.var.has.accelerometer=
ubootenv.var.upgradefbc=
ubootenv.var.outputmode=
ubootenv.var.lcd_reverse=
ubootenv.var.console_bug=
ubootenv.var.panel_id=
ubootenv.var.panel_type=
ubootenv.var.bootfusb=
ubootenv.var.reboot_mode=
ubootenv.var.bootonetime=tv.need.preview_window=true
#TV project,set omx to video layer,or PQ hasn't effect
media.omx.display_mode=1#
# ADDITIONAL_BUILD_PROPERTIES
#
ro.config.wallpaper=/system/etc/default_wallpaper.png
ro.build.skyversion=018.012.290
ro.com.android.dateformat=MM-dd-yyyy
ro.config.ringtone=Ring_Synth_04.ogg
ro.config.notification_sound=pixiedust.ogg
ro.carrier=unknown
ro.config.alarm_alert=Alarm_Classic.ogg
ro.opengles.version=131072
camera.disable_zsl_mode=1
ro.app.optimization=true
ro.product.firmware=00502001
ro.product.otaupdateurl=http://10.28.11.53:8080/otaupdate/update
persist.sys.timezone=Asia/Shanghai
dalvik.vm.heapstartsize=16m
dalvik.vm.heapgrowthlimit=192m
dalvik.vm.heapsize=512m
dalvik.vm.heaptargetutilization=0.75
dalvik.vm.heapminfree=512k
dalvik.vm.heapmaxfree=8m
sys.fb.bits=32
ro.hdmi.device_type=0
wifi.interface=wlan0
config.disable_bluetooth=false
ro.config.media_vol_steps=100
ro.product.support.tvaudio=true
drm.service.enable=true
ro.platform.has.pppoe=true
config.disable_instaboot=false
persist.sys.dalvik.vm.lib.2=libart.so
dalvik.vm.isa.arm.features=default
dalvik.vm.dexopt-flags=m=y
net.bt.name=Android

Android 查询设备信息c/c++常用方法相关推荐

  1. 获取Android 手机设备信息:包括机型、操作系统版本号、手机分辨率、运营商、当前联网方式、IMEI、MEID、MAC地址

    获取Android 手机设备信息:操作系统版本号.手机分辨率.运营商.当前联网方式.IMEI.MEID.MAC地址 包括双卡机型上的两个IMEI信息 /*** Created by Administr ...

  2. android检测设备信息,安卓手机设备信息检测app

    安卓手机设备信息检测app是一款能够帮助用户快速检测自己的手机设备的硬件以及相关系统的app,这款app能够在最快的时间内检测出手机的所有硬件信息与手机系统的版本信息吗,让用户瞬间了解到自己的手机信息 ...

  3. Android - 获取设备信息的工具类( DeviceUtil)

    注解: 封装了安装常用的设备信息查询的工具类: 设备宽度.设备高度.SD卡判断.是否有网.版本名称.版本号.唯一标识.手机品牌.手机型号.API等级.Android版本.App进程Id.App进程Na ...

  4. android异常信息,Android 获取设备信息 异常

    /**获取设备信息 * @param c * @return */ public static void setDeviceInfo(Context c,RequestParams params){ ...

  5. Flutter获取Android/iOS设备信息

    我们在进行各个系统的原生开发时,都有对应的方法获取设备信息,那么在使用Flutter时如何获取设备相关的相关信息呢? 我们本文就来介绍一个Flutter插件: Flutter Device Info ...

  6. Android 手机设备信息获取使用详解

    Android 手机是我们常用的工具之一,买手机之前,手机厂商会提供一些手机参数给我们,那么问题来了,我们该如何获取手机上的参数信息呢? 通过本文你讲了解到获取手机常用信息的基本方法. 获取手机基本信 ...

  7. android 查询wifi信息的类,Android 获取wifi信息

    在androi中WIFI信息的获取可以通过系统提供的WIFI Service获取. WifiManager wifi_service = (WifiManager)getSystemService(W ...

  8. Android查询通讯录信息

    文章目录 前言 一.使用URI查询Android通讯录的本质 二.使用步骤 1.随便写个布局 2.item构造 3.MainActivity 4.MessageBean 5. MessageAdapt ...

  9. android查询cpu信息

    文章目录 1.启动环境 2.adb命令查询 3.cpu参数信息解释 1.启动环境 用adb环境进行查询信息. 1.用cmd命令启动控制台窗口,然后在启动adb环境. 2.adb环境连接(connect ...

最新文章

  1. 20210614 So-called的用法
  2. html自动get,HTML Get
  3. UML类图与类间六种关系表示
  4. Web框架——Flask系列之模板使用练习(六)
  5. 散列表(二):冲突处理的方法之链地址法的实现
  6. 藏的太深!原来支付宝还有另一个“集福”活动
  7. Qt中文本编辑器实现语法高亮功能(Qscitinlla)
  8. X-Scan使用教程
  9. python微信爬虫
  10. 国内学术科研论坛整理
  11. deepin更新启动项_Deepin修复启动项菜单---grub2启动修复
  12. 男主龙失忆java_男主失忆的小说推荐:我忘了全世界,却记得对你的爱,一生不变...
  13. C语言 实现长整数的相加
  14. 计算机教师师徒结对师傅总结,师徒结对师傅小结
  15. 传统客服压力山大,如何应用智能客服打造直击痛点的解决方案?
  16. CSP-202112-3-登机牌
  17. ABBYY FineReader如何创建用户语言
  18. COMSOL在云平台的使用教程,超高效的方法来了
  19. 老男孩教育 | 0基础学习三个月的心得分享!
  20. 数字图像处理(十)腐蚀和膨胀

热门文章

  1. python入门学习(excel导入mysql)
  2. 向上的路,从来都不好走(好文力荐)
  3. oracle 4098,ORA-04098错误解决方法-数据库专栏,ORACLE
  4. Java程序员从笨鸟到菜鸟之(五十七)细谈Hibernate(八)Hibernate集合Map关系映射
  5. Python作画玫瑰花
  6. 揣测一下未来的政策走向
  7. [转] 一个女生写给男朋友的!!!~~有点现实、冷静的语言,却让人感觉很温暖!!!
  8. Flink on Yarn报错:Container released on a *lost* node
  9. python编程从入门到实践练习15-3:分子运动
  10. 吉首大学校赛 K 白山茶与红玫瑰 (线段树区间操作)