Skip to content

Commit

Permalink
Merge pull request #51 from atsuko-fukui/android12_pass_delay_configu…
Browse files Browse the repository at this point in the history
…ration

Permission HIGH_SAMPLING_RATE_SENSORS required when targeting Android 12
  • Loading branch information
tomoima525 authored Dec 30, 2021
2 parents e47355b + 4762861 commit 43606f3
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions debot-no-op/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'

android {
compileSdkVersion 30
compileSdkVersion 31

defaultConfig {
minSdkVersion 16
targetSdkVersion 29
targetSdkVersion 31
versionCode 1
versionName "1.0"
}
Expand Down
3 changes: 2 additions & 1 deletion debot-no-op/src/main/java/com/tomoima/debot/Debot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ class Debot private constructor()//Do nothing

fun allowShake(context: Context) {}

fun startSensor(activity: FragmentActivity) {}
@JvmOverloads
fun startSensor(activity: FragmentActivity, sensorDelay: Int = 0) {}

fun stopSensor() {}

Expand Down
4 changes: 2 additions & 2 deletions debot-sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 30
compileSdkVersion 31

defaultConfig {
applicationId "com.tomoima.debot.sample"
minSdkVersion 16
targetSdkVersion 29
targetSdkVersion 31
versionCode 1
versionName "1.0"
}
Expand Down
1 change: 1 addition & 0 deletions debot-sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
android:theme="@style/AppTheme" >
<activity
android:name="com.tomoima.debot.sample.activity.MainActivity"
android:exported="true"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.tomoima.debot.sample.activity;

import android.hardware.SensorManager;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
Expand Down
4 changes: 2 additions & 2 deletions debot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'

android {
compileSdkVersion 30
compileSdkVersion 31

defaultConfig {
minSdkVersion 16
targetSdkVersion 29
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
Expand Down
5 changes: 3 additions & 2 deletions debot/src/main/java/com/tomoima/debot/Debot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ class Debot private constructor() {
setupSensor(context)
}

fun startSensor(activity: FragmentActivity) {
@JvmOverloads
fun startSensor(activity: FragmentActivity, sensorDelay: Int = SensorManager.SENSOR_DELAY_GAME) {
if (!canShake) return
activityWeakRef = WeakReference(activity)
sd?.start(sensorManager)
sd?.start(sensorManager, sensorDelay)
}

fun stopSensor() {
Expand Down
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ext.versions = [

supportLibrary : '27.1.0',
androidKtx : '0.2',
seismic : '1.0.2',
seismic : '1.0.3',
junit : '4.12',
testRunner: '1.0.1',
espressoCore : '3.0.1',
Expand Down

0 comments on commit 43606f3

Please sign in to comment.