Skip to content
Snippets Groups Projects
Commit 16185869 authored by René Schöne's avatar René Schöne
Browse files

Reduce minSdkVersion to run on Moto 360.

parent 11fa3524
Branches
No related tags found
No related merge requests found
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</value> </value>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
......
...@@ -6,7 +6,7 @@ android { ...@@ -6,7 +6,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 24 minSdkVersion 23
targetSdkVersion 26 targetSdkVersion 26
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
......
...@@ -4,7 +4,7 @@ android { ...@@ -4,7 +4,7 @@ android {
compileSdkVersion 26 compileSdkVersion 26
defaultConfig { defaultConfig {
applicationId "de.tudresden.inf.st.sensorsharing" applicationId "de.tudresden.inf.st.sensorsharing"
minSdkVersion 25 minSdkVersion 23
targetSdkVersion 26 targetSdkVersion 26
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
...@@ -22,11 +22,11 @@ dependencies { ...@@ -22,11 +22,11 @@ dependencies {
implementation project(':common') implementation project(':common')
implementation 'com.google.android.support:wearable:2.2.0' implementation 'com.google.android.support:wearable:2.3.0'
implementation 'com.google.android.gms:play-services-wearable:11.8.0' implementation 'com.google.android.gms:play-services-wearable:15.0.1'
implementation 'com.android.support:percent:26.1.0' implementation 'com.android.support:percent:26.1.0'
implementation 'com.android.support:support-v4:26.1.0' implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0' implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:wear:26.1.0' implementation 'com.android.support:wear:26.1.0'
compileOnly 'com.google.android.wearable:wearable:2.2.0' compileOnly 'com.google.android.wearable:wearable:2.3.0'
} }
...@@ -62,7 +62,27 @@ public class MainActivity extends WearableActivity implements SensorEventListene ...@@ -62,7 +62,27 @@ public class MainActivity extends WearableActivity implements SensorEventListene
// initialize sensors // initialize sensors
mLight = mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT); mLight = mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
mLinearAcceleration = mSensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION); mLinearAcceleration = mSensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION);
if (mLinearAcceleration == null) {
mLinearAcceleration = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
if (mRotationVector == null) {
Log.e(TAG, "Couldn't find acceleration sensor!");
TextView textView = findViewById(R.id.acceleration_value);
textView.setText("ERROR");
} else {
Log.w(TAG, "Using alternative accelerometer sensor!");
}
}
mRotationVector = mSensorManager.getDefaultSensor(Sensor.TYPE_GAME_ROTATION_VECTOR); mRotationVector = mSensorManager.getDefaultSensor(Sensor.TYPE_GAME_ROTATION_VECTOR);
if (mRotationVector == null) {
mRotationVector = mSensorManager.getDefaultSensor(Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR);
if (mRotationVector == null) {
TextView textView = findViewById(R.id.rotation_value);
textView.setText("ERROR");
Log.e(TAG, "Couldn't find rotation sensor!");
} else {
Log.w(TAG, "Using alternative rotation sensor!");
}
}
// initialize sensor values // initialize sensor values
mLinearAccelerationValues = new float[3]; mLinearAccelerationValues = new float[3];
...@@ -84,11 +104,13 @@ public class MainActivity extends WearableActivity implements SensorEventListene ...@@ -84,11 +104,13 @@ public class MainActivity extends WearableActivity implements SensorEventListene
sendCurrentValueToAllConnectedNodes(); sendCurrentValueToAllConnectedNodes();
break; break;
case Sensor.TYPE_LINEAR_ACCELERATION: case Sensor.TYPE_LINEAR_ACCELERATION:
case Sensor.TYPE_ACCELEROMETER:
mLinearAccelerationValues = sensorEvent.values; mLinearAccelerationValues = sensorEvent.values;
textView = findViewById(R.id.acceleration_value); textView = findViewById(R.id.acceleration_value);
textView.setText(formatArray3(mLinearAccelerationValues)); textView.setText(formatArray3(mLinearAccelerationValues));
break; break;
case Sensor.TYPE_GAME_ROTATION_VECTOR: case Sensor.TYPE_GAME_ROTATION_VECTOR:
case Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR:
mRotationVectorValues = sensorEvent.values; mRotationVectorValues = sensorEvent.values;
textView = findViewById(R.id.rotation_value); textView = findViewById(R.id.rotation_value);
textView.setText(formatArray3(mRotationVectorValues)); textView.setText(formatArray3(mRotationVectorValues));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment