1.在项目根目录下的build.gradle文件中,
allprojects {
repositories {
maven {
url 'https://s01.oss.sonatype.org/content/repositories/releases/'
}
}
}
2.在entry模块的build.gradle文件中,
dependencies {
implementation('com.gitee.chinasoft_ohos:sensorManager:1.0.0')
......
}
在sdk6,DevEco Studio2.2 beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下
try {
ESSensorManager sensorManager = ESSensorManager.getSensorManager(getContext());
int subscriptionId = sensorManager.subscribeToSensorData(SensorUtils.SENSOR_TYPE_ACCELEROMETER, this);
} catch (ESException e) {
e.printStackTrace();
}
try {
sensorManager.unsubscribeFromSensorData(subscriptionId);
} catch (ESException e) {
e.printStackTrace();
}
public final static int SENSOR_TYPE_ACCELEROMETER = 5001;
public final static int SENSOR_TYPE_BATTERY = 5002;
public final static int SENSOR_TYPE_BLUETOOTH = 5003;
public final static int SENSOR_TYPE_LOCATION = 5004;
public final static int SENSOR_TYPE_MICROPHONE = 5005;
public final static int SENSOR_TYPE_PHONE_STATE = 5006;
public final static int SENSOR_TYPE_PROXIMITY = 5007;
public final static int SENSOR_TYPE_SCREEN = 5008;
public final static int SENSOR_TYPE_SMS = 5009;
public final static int SENSOR_TYPE_WIFI = 5010;
public final static int SENSOR_TYPE_CONNECTION_STATE = 5011;
public final static int SENSOR_TYPE_SMS_CONTENT_READER = 5013;
public final static int SENSOR_TYPE_CALL_CONTENT_READER = 5014;
public final static int SENSOR_TYPE_GYROSCOPE = 5016;
public final static int SENSOR_TYPE_LIGHT = 5017;
public final static int SENSOR_TYPE_PHONE_RADIO = 5018;
public final static int SENSOR_TYPE_CONNECTION_STRENGTH = 5019;
public final static int SENSOR_TYPE_PASSIVE_LOCATION = 5020;
public final static int SENSOR_TYPE_AMBIENT_TEMPERATURE = 5021;
public final static int SENSOR_TYPE_PRESSURE = 5022;
public final static int SENSOR_TYPE_HUMIDITY = 5023;
public final static int SENSOR_TYPE_MAGNETIC_FIELD = 5024;
public final static int SENSOR_TYPE_STEP_COUNTER = 5025;
public final static int SENSOR_TYPE_INTERACTION = 5026;
CodeCheck代码测试无异常
CloudTest代码测试无异常
病毒安全检测通过
当前版本demo功能与原组件基本无差异
Copyright (c), University of Cambridge
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型