你好。
放置在应用程序中,能够读取环境温度传感器的值
temperaturelabel = (TextView) findViewById(R.id.myTemp);
mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
if(Build.VERSION.SDK_INT>= Build.VERSION_CODES.ICE_CREAM_SANDWICH){
mTemperature= mSensorManager.getDefaultSensor(Sensor.TYPE_AMBIENT_TEMPERATURE);
}
if (mTemperature == null) {
temperaturelabel.setText(NOT_SUPPORTED_MESSAGE);
}
在模拟器中运行时
Name: Nexus_6_API_27 CPU/ABI: Google APIs Intel Atom (x86) Path: C:\Users\drno\.android\avd\Nexus_6_API_27.avd Target: google_apis [Google APIs] (API level 27) Skin: nexus_6 SD Card: 100M hw.dPad: no runtime.network.speed: full hw.accelerometer: yes hw.device.name: Nexus 6 vm.heapSize: 256 skin.dynamic: yes hw.device.manufacturer: Google hw.gps: yes hw.initialOrientation: Portrait image.androidVersion.api: 27 hw.audioInput: yes image.sysdir.1: system-images\android-27\google_apis\x86\ tag.id: google_apis showDeviceFrame: yes hw.camera.back: emulated hw.mainKeys: no AvdId: Nexus_6_API_27 hw.camera.front: emulated hw.lcd.density: 560 avd.ini.displayname: Nexus 6 API 27 hw.gpu.mode: auto hw.device.hash2: MD5:9b564b60b1aebee32c73ded9daa1e620 hw.ramSize: 1536 hw.trackBall: no hw.battery: yes hw.cpu.ncore: 4 hw.sdCard: yes tag.display: Google APIs runtime.network.latency: none hw.keyboard: yes hw.sensors.proximity: yes disk.dataPartition.size: 800M hw.sensors.orientation: yes avd.ini.encoding: UTF-8 hw.gpu.enabled: yes
好的
收集的 APK 上传到三星 Galaxy Note 4 应用程序返回了一个关于温度传感器不可用的错误 -抱歉,传感器不适用于此设备
请帮我找出原因。
ps项目链接
三星 Galaxy Note 4 没有温度传感器,甚至 2017 年的旗舰三星 Galaxy S8+ 也没有。