Skip to content

Commit

Permalink
Release 0.3.0 (#13)
Browse files Browse the repository at this point in the history
* Release 0.3.0

- Adds a new sample app for core
- Updates the sample apps for the variants
- Upgrade agp
- Adds documentation

* update documentation
  • Loading branch information
rahul27 authored Feb 18, 2022
1 parent a93a68d commit 8d2d3b9
Show file tree
Hide file tree
Showing 29 changed files with 772 additions and 13 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ maven {

## Version History

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.
The latest release of the SDK is `0.3.0`. Details about the current and past releases can be found in the [Releases](https://github.com/moonsense/moonsense-android-sdk/releases) section.


## Integration
Expand Down Expand Up @@ -57,10 +57,11 @@ Additionally, a [MoonsenseCallback](https://android.sdk-docs.moonsense.io/sdk/io

The SDK reference can be found at [android.sdk-docs.moonsense.io](https://android.sdk-docs.moonsense.io/).

This repo includes two sample apps:
This repo includes three sample apps:

- `sample-app` - This sample app demonstrates the use of the Moonsense Android SDK within an application context. The example in this case is quite simple and minimal and can serve as a good starting point for developers looking for a quick integration.
- `sample-payment-app` - This sample app demonstrates the library usage of the Moonsense Android SDK. Note that the `sample-payment-app` does not directly depend on the Moonsense Android SDK. Instead it includes a dependency to the `sample-payment-sdk` which then packages the Moonsense Android SDK. The app developer here does not have any visibility into the Moonsense Android SDK as they only interface with the `sample-payment-sdk`. The example is useful for SDK/library developers looking to integrate the Moonsense Android SDK.
- `sample-core-app` - This sample app shows how to integrate a variation of the Moonsense Android SDK called the Core SDK. For all intents and purposes the standard Android SDK (referred to as the Cloud SDK) should suffice for a majority of use cases. In case you do need specialized use of the Moonsense SDK contact [[email protected]](mailto:[email protected]) for access. Additional information regarding the Core SDK can be found here - [Advanced Usage](https://docs.moonsense.io/articles/sdk/advanced-usage).

## Terms Of Service

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/AppConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ object AppConfig {
const val minSdkVersion = 16
const val targetSdkVersion = 31
const val versionCode = 1
const val versionName = "0.2.0"
const val versionName = "0.3.0"
const val buildToolsVersion = "30.0.3"
const val androidTestInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
const val jvmTarget = "11"
Expand Down
6 changes: 5 additions & 1 deletion buildSrc/src/main/java/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
*/

object Versions {
const val gradleTools = "7.1.0"
const val gradleTools = "7.1.1"
const val kotlinVersion = "1.6.0"
const val junit = "4.13.2"
const val junitAndroidX = "1.1.3"
const val espressoCore = "3.4.0"
const val squareWireRuntime = "4.0.1"
const val constraintLayout = "2.1.0"
const val fragmentKtx = "1.3.6"
const val androidXLegacySupport = "1.0.0"
const val material = "1.4.0"
const val retrofit = "2.6.0"
const val gson = "2.8.9"
const val mockWebServer = "4.9.3"
}
1 change: 1 addition & 0 deletions sample-core-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
53 changes: 53 additions & 0 deletions sample-core-app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
plugins {
id("com.android.application")
id("kotlin-android")
}

android {
compileSdk = AppConfig.compileSdkVersion
buildToolsVersion = AppConfig.buildToolsVersion

defaultConfig {
applicationId = "io.moonsense.sdk.core.sample"
minSdk = AppConfig.minSdkVersion
targetSdk = AppConfig.targetSdkVersion
versionCode = AppConfig.versionCode
versionName = AppConfig.versionName
testInstrumentationRunner = AppConfig.androidTestInstrumentationRunner
}

buildTypes {
getByName("release") {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
getByName("debug") {
isMinifyEnabled = false
isDebuggable = true
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = AppConfig.jvmTarget
}
}

dependencies {
implementation("io.moonsense:android-core-sdk:${AppConfig.versionName}")
implementation("com.squareup.wire:wire-runtime:${Versions.squareWireRuntime}")
implementation("com.squareup.retrofit2:retrofit:${Versions.retrofit}")
implementation("com.squareup.retrofit2:converter-gson:${Versions.retrofit}")
implementation("com.google.code.gson:gson:${Versions.gson}")
implementation("com.squareup.okhttp3:mockwebserver:${Versions.mockWebServer}")
implementation("androidx.constraintlayout:constraintlayout:${Versions.constraintLayout}")
testImplementation("junit:junit:${Versions.junit}")
androidTestImplementation("androidx.test.ext:junit:${Versions.junitAndroidX}")
androidTestImplementation("androidx.test.espresso:espresso-core:${Versions.espressoCore}")
}
21 changes: 21 additions & 0 deletions sample-core-app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2021 Moonsense, Inc. All rights reserved.
* Created by rahul on 7/16/21, 11:07 AM
*/

package io.moonsense.sdk.core.sample

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("io.moonsense.sdk.core.sample", appContext.packageName)
}
}
22 changes: 22 additions & 0 deletions sample-core-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.moonsense.sdk.core.sample">

<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2022 Moonsense, Inc. All rights reserved.
* Created by rahul on 2/11/22, 2:45 PM
*/

package io.moonsense.sdk.core.sample

import android.app.Activity
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import io.moonsense.sdk.core.sample.sdk.AcmeSdk
import io.moonsense.sdk.core.sample.server.AcmeServer

internal class MainActivity : Activity() {

private lateinit var acmeServer: AcmeServer
private lateinit var acmeSdk: AcmeSdk

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val dataTextView = findViewById<TextView>(R.id.data)
acmeServer = AcmeServer(object : AcmeServer.AcmeServerListener {
override fun onDataReceived(sessionId: String, count: Int) {
runOnUiThread {
dataTextView.append(
"Session $sessionId received $count samples\n"
)
}
}
})
acmeServer.start()
acmeSdk = AcmeSdk(this)
findViewById<Button>(R.id.record).setOnClickListener {
acmeSdk.record()
}
}

override fun onDestroy() {
super.onDestroy()
acmeServer.stop()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2022 Moonsense, Inc. All rights reserved.
* Created by rahul on 2/11/22, 4:42 PM
*/

package io.moonsense.sdk.core.sample.sdk

/**
* Represent the Acme version of the
* data collected from the Moonsense Bundle.
*/
data class AcmeRequest(
/**
* Tht id of the [AcmeSession].
*/
val acmeSessionId: String,
/**
* The id of the corresponding Moonsense
* Session.
*/
val moonsenseSessionId: String,
/**
* For some reason Acme is only interested in
* Accelerometer data.
*/
val accelerometerData: List<Triple<Double, Double, Double>>
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2022 Moonsense, Inc. All rights reserved.
* Created by rahul on 2/14/22, 2:03 PM
*/

package io.moonsense.sdk.core.sample.sdk

/**
* Returns a result of the data upload.
*/
data class AcmeResponse(
/**
* Number of samples processed.
*/
val count: Int
)
Loading

0 comments on commit 8d2d3b9

Please sign in to comment.