diff --git a/README.md b/README.md
index 3a99186..ee7efd9 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ maven {
## Version History
-The latest release of the SDK is `0.1.2`. Details about the current and past releases can be found in the [Releases](https://github.com/moonsense/moonsense-android-sdk/releases) section.
+The latest release of the SDK is `0.2.0`. Details about the current and past releases can be found in the [Releases](https://github.com/moonsense/moonsense-android-sdk/releases) section.
## Integration
diff --git a/buildSrc/src/main/java/AppConfig.kt b/buildSrc/src/main/java/AppConfig.kt
index 9caa1b8..5a3e9d0 100644
--- a/buildSrc/src/main/java/AppConfig.kt
+++ b/buildSrc/src/main/java/AppConfig.kt
@@ -8,7 +8,7 @@ object AppConfig {
const val minSdkVersion = 16
const val targetSdkVersion = 31
const val versionCode = 1
- const val versionName = "0.1.2"
+ const val versionName = "0.2.0"
const val buildToolsVersion = "30.0.3"
const val androidTestInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
const val jvmTarget = "11"
diff --git a/sample-app/src/main/ic_launcher-playstore.png b/sample-app/src/main/ic_launcher-playstore.png
new file mode 100644
index 0000000..4d4aa2e
Binary files /dev/null and b/sample-app/src/main/ic_launcher-playstore.png differ
diff --git a/sample-app/src/main/java/io/moonsense/sdk/sample/MainActivity.kt b/sample-app/src/main/java/io/moonsense/sdk/sample/MainActivity.kt
index 19aff0e..b2b9381 100644
--- a/sample-app/src/main/java/io/moonsense/sdk/sample/MainActivity.kt
+++ b/sample-app/src/main/java/io/moonsense/sdk/sample/MainActivity.kt
@@ -57,9 +57,8 @@ internal class MainActivity : Activity() {
// this call also returns a session object containing
// additional information about the started session
Moonsense.startSession(
- DEFAULT_SESSION_DURATION_SECONDS,
- TimeUnit.SECONDS,
- listOf(DEFAULT_SESSION_LABEL)
+ TimeUnit.SECONDS.toMillis(DEFAULT_SESSION_DURATION_SECONDS),
+ labels = listOf(DEFAULT_SESSION_LABEL)
)
}
diff --git a/sample-app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/sample-app/src/main/res/drawable-v24/ic_launcher_foreground.xml
index 2b068d1..36ba3e7 100644
--- a/sample-app/src/main/res/drawable-v24/ic_launcher_foreground.xml
+++ b/sample-app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -4,27 +4,35 @@
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
-
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
\ No newline at end of file
+
+
+
+
+
diff --git a/sample-app/src/main/res/drawable/ic_launcher_background.xml b/sample-app/src/main/res/drawable/ic_launcher_background.xml
index 07d5da9..ca3826a 100644
--- a/sample-app/src/main/res/drawable/ic_launcher_background.xml
+++ b/sample-app/src/main/res/drawable/ic_launcher_background.xml
@@ -1,170 +1,74 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ xmlns:android="http://schemas.android.com/apk/res/android">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sample-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/sample-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
index eca70cf..bbd3e02 100644
--- a/sample-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ b/sample-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/sample-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/sample-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
index eca70cf..bbd3e02 100644
--- a/sample-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ b/sample-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/sample-payment-app/src/main/ic_launcher-playstore.png b/sample-payment-app/src/main/ic_launcher-playstore.png
new file mode 100644
index 0000000..963661a
Binary files /dev/null and b/sample-payment-app/src/main/ic_launcher-playstore.png differ
diff --git a/sample-payment-app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/sample-payment-app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 0000000..3f12755
--- /dev/null
+++ b/sample-payment-app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sample-payment-app/src/main/res/drawable/ic_launcher_background.xml b/sample-payment-app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..ca3826a
--- /dev/null
+++ b/sample-payment-app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sample-payment-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/sample-payment-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..bbd3e02
--- /dev/null
+++ b/sample-payment-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/sample-payment-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/sample-payment-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..bbd3e02
--- /dev/null
+++ b/sample-payment-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/sample-payment-app/src/main/res/mipmap-hdpi/ic_launcher.png b/sample-payment-app/src/main/res/mipmap-hdpi/ic_launcher.png
index 7fddfd8..788f2ff 100644
Binary files a/sample-payment-app/src/main/res/mipmap-hdpi/ic_launcher.png and b/sample-payment-app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/sample-payment-app/src/main/res/mipmap-mdpi/ic_launcher.png b/sample-payment-app/src/main/res/mipmap-mdpi/ic_launcher.png
index 7217e1f..74c9034 100644
Binary files a/sample-payment-app/src/main/res/mipmap-mdpi/ic_launcher.png and b/sample-payment-app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/sample-payment-app/src/main/res/mipmap-xhdpi/ic_launcher.png b/sample-payment-app/src/main/res/mipmap-xhdpi/ic_launcher.png
index ed53d78..9b4c52d 100644
Binary files a/sample-payment-app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/sample-payment-app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/sample-payment-app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/sample-payment-app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index fa1eef1..7cdffef 100644
Binary files a/sample-payment-app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/sample-payment-app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/sample-payment-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/sample-payment-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index 5873e2e..500ea47 100644
Binary files a/sample-payment-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/sample-payment-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/sample-payment-sdk/src/main/java/io/moonsense/sample/payment/sdk/Payment.kt b/sample-payment-sdk/src/main/java/io/moonsense/sample/payment/sdk/Payment.kt
index 2ad30a7..8f100cc 100644
--- a/sample-payment-sdk/src/main/java/io/moonsense/sample/payment/sdk/Payment.kt
+++ b/sample-payment-sdk/src/main/java/io/moonsense/sample/payment/sdk/Payment.kt
@@ -9,6 +9,8 @@ import android.content.Context
import android.widget.Toast
import io.moonsense.sdk.Moonsense
import io.moonsense.sdk.callback.MoonsenseCallback
+import io.moonsense.sdk.config.SDKConfig
+import io.moonsense.sdk.config.SensorType
import io.moonsense.sdk.exception.MoonsenseException
import io.moonsense.sdk.model.Session
@@ -25,7 +27,21 @@ object Payment {
Moonsense.initialize(
context,
"ADD PUBLIC TOKEN HERE ..",
- object : MoonsenseCallback {
+ SDKConfig(
+ // capture sensors that produce data at 50 Hz
+ globalSamplingRate = 50,
+ // generate bundles every half second
+ bundleGenerationInterval = 500L,
+ // only specify typing sensors when starting a session
+ // with no session config
+ sensorTypes = listOf(
+ SensorType.TOUCH,
+ SensorType.KEY_PRESS,
+ SensorType.FOCUS_CHANGE,
+ SensorType.TEXT_CHANGE
+ )
+ ),
+ moonsenseCallback = object : MoonsenseCallback {
override fun onError(ex: MoonsenseException) {
Toast.makeText(
context,
diff --git a/sample-payment-sdk/src/main/java/io/moonsense/sample/payment/sdk/PaymentDialog.kt b/sample-payment-sdk/src/main/java/io/moonsense/sample/payment/sdk/PaymentDialog.kt
index eba5381..e768b48 100644
--- a/sample-payment-sdk/src/main/java/io/moonsense/sample/payment/sdk/PaymentDialog.kt
+++ b/sample-payment-sdk/src/main/java/io/moonsense/sample/payment/sdk/PaymentDialog.kt
@@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit
import com.google.android.material.bottomsheet.BottomSheetBehavior
import android.widget.FrameLayout
+import io.moonsense.sdk.config.SessionConfig
import java.lang.StringBuilder
/**
@@ -33,7 +34,8 @@ import java.lang.StringBuilder
class PaymentDialog(private val paymentListener: PaymentListener) :
BottomSheetDialogFragment() {
- private var session: Session? = null
+ private var sessionWithAllSensors: Session? = null
+ private var sessionWithTypingSensors: Session? = null
private lateinit var swipeToBuyView: SwipeToBuyView
private var isCardValid = false
@@ -132,17 +134,28 @@ class PaymentDialog(private val paymentListener: PaymentListener) :
dialog?.findViewById(R.id.design_bottom_sheet) as FrameLayout
BottomSheetBehavior.from(bottomSheet).state = BottomSheetBehavior.STATE_EXPANDED
}
- session = Moonsense.startSession(
- 1,
- TimeUnit.HOURS,
- listOf(PAYMENT_SDK_LABEL)
+
+ // start a long running session with the typing sensors
+ // specified in the SDKConfig during initialization
+ sessionWithTypingSensors = Moonsense.startSession(
+ TimeUnit.HOURS.toMillis(TYPING_SESSION_DURATION_HOURS),
+ labels = listOf(PAYMENT_SDK_LABEL_TYPING_SENSORS)
+ )
+
+ // start a shorter session recording all sensors
+ sessionWithAllSensors = Moonsense.startSession(
+ TimeUnit.SECONDS.toMillis(ALL_SENSORS_SESSION_DURATION_SECONDS),
+ // empty config records all sensors
+ SessionConfig(),
+ listOf(PAYMENT_SDK_LABEL_ALL_SENSORS)
)
arguments?.getFloat(ARG_TOTAL_PRICE)?.let {
val formattedPrice = "$ $it"
totalPrice.text = formattedPrice
}
view.findViewById(R.id.close_button).setOnClickListener {
- session?.stopSession()
+ sessionWithTypingSensors?.stopSession()
+ sessionWithAllSensors?.stopSession()
paymentListener.onDismissed()
dismiss()
}
@@ -153,7 +166,8 @@ class PaymentDialog(private val paymentListener: PaymentListener) :
val swipeToBuyView = view.findViewById(R.id.swipe_to_buy_view)
swipeToBuyView.setOnCompleteRunnable {
- session?.stopSession()
+ sessionWithTypingSensors?.stopSession()
+ sessionWithAllSensors?.stopSession()
paymentListener.onComplete()
dismiss()
}
@@ -202,7 +216,8 @@ class PaymentDialog(private val paymentListener: PaymentListener) :
override fun onCancel(dialog: DialogInterface) {
super.onCancel(dialog)
- session?.stopSession()
+ sessionWithTypingSensors?.stopSession()
+ sessionWithAllSensors?.stopSession()
paymentListener.onDismissed()
}
@@ -227,7 +242,10 @@ class PaymentDialog(private val paymentListener: PaymentListener) :
private const val PAYMENT_FRAGMENT_TAG = "payment_fragment_dialog"
private const val ARG_TOTAL_PRICE = "total_price"
- private const val PAYMENT_SDK_LABEL = "android_payment_sdk_sample"
+ private const val PAYMENT_SDK_LABEL_ALL_SENSORS = "android_payment_sdk_sample_all_sensors"
+ private const val PAYMENT_SDK_LABEL_TYPING_SENSORS = "android_payment_sdk_sample_typing_sensors"
+ private const val TYPING_SESSION_DURATION_HOURS = 1L
+ private const val ALL_SENSORS_SESSION_DURATION_SECONDS = 30L
private const val CARD_MAX_CHARS = 19
private const val CARD_SEPARATOR_MOD = 5