diff --git a/app/build.gradle b/app/build.gradle index 0c88818..483cfd0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,8 +14,8 @@ android { applicationId "com.tiefensuche.motionmate" minSdkVersion 14 targetSdkVersion 28 - versionCode 6 - versionName "1.3" + versionCode 7 + versionName "1.3.1" proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } signingConfigs { diff --git a/app/src/main/java/com/tiefensuche/motionmate/service/MotionService.kt b/app/src/main/java/com/tiefensuche/motionmate/service/MotionService.kt index 49f95ca..9da58fe 100644 --- a/app/src/main/java/com/tiefensuche/motionmate/service/MotionService.kt +++ b/app/src/main/java/com/tiefensuche/motionmate/service/MotionService.kt @@ -77,7 +77,7 @@ internal class MotionService : Service() { val manager = packageManager // connect sensor - val mSensorManager = getSystemService(Context.SENSOR_SERVICE) as? SensorManager ?: throw RuntimeException() + val mSensorManager = getSystemService(Context.SENSOR_SERVICE) as? SensorManager ?: throw IllegalStateException("could not get sensor service") var mStepSensor: Sensor? = null if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && manager.hasSystemFeature(PackageManager.FEATURE_SENSOR_STEP_COUNTER)) { // androids built in step counter @@ -90,7 +90,7 @@ internal class MotionService : Service() { } override fun onAccuracyChanged(sensor: Sensor, accuracy: Int) { - + // no-op } } } else if (manager.hasSystemFeature(PackageManager.FEATURE_SENSOR_ACCELEROMETER)) { @@ -112,7 +112,7 @@ internal class MotionService : Service() { } override fun onAccuracyChanged(sensor: Sensor, accuracy: Int) { - + // no-op } } } @@ -196,7 +196,7 @@ internal class MotionService : Service() { } private fun startService() { - mNotificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as? NotificationManager ?: throw RuntimeException() + mNotificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as? NotificationManager ?: throw IllegalStateException("could not get notification service") val notificationIntent = Intent(this, MainActivity::class.java) val pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0) // Notification channels are only supported on Android O+. diff --git a/app/src/main/java/com/tiefensuche/motionmate/util/Database.kt b/app/src/main/java/com/tiefensuche/motionmate/util/Database.kt index 22412c4..182185c 100644 --- a/app/src/main/java/com/tiefensuche/motionmate/util/Database.kt +++ b/app/src/main/java/com/tiefensuche/motionmate/util/Database.kt @@ -27,7 +27,7 @@ internal class Database private constructor(context: Context) : SQLiteOpenHelper FIELD_TYPE_INTEGER -> cursor.getLong(0) FIELD_TYPE_FLOAT -> cursor.getFloat(0) FIELD_TYPE_NULL -> 0 - else -> throw Exception("unexpected type") + else -> throw IllegalStateException("unexpected type") } cursor.close() return result @@ -80,7 +80,7 @@ internal class Database private constructor(context: Context) : SQLiteOpenHelper } override fun onUpgrade(sqLiteDatabase: SQLiteDatabase, i: Int, i1: Int) { - + // no-op } internal inner class Entry internal constructor(val timestamp: Long, val steps: Int)