-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
Showing
29 changed files
with
772 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
28 changes: 28 additions & 0 deletions
28
sample-core-app/src/androidTest/java/io/moonsense/sdk/core/sample/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
44 changes: 44 additions & 0 deletions
44
sample-core-app/src/main/java/io/moonsense/sdk/core/sample/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
sample-core-app/src/main/java/io/moonsense/sdk/core/sample/sdk/AcmeRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>> | ||
) |
16 changes: 16 additions & 0 deletions
16
sample-core-app/src/main/java/io/moonsense/sdk/core/sample/sdk/AcmeResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) |
Oops, something went wrong.