Skip to content

Commit 1f59112

Browse files
authored
feat: add mparticle to sample app (#2)
1 parent 22cc9fd commit 1f59112

File tree

9 files changed

+426
-2
lines changed

9 files changed

+426
-2
lines changed

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,30 @@ jobs:
8888
run: |
8989
./gradlew assembleRelease
9090
91+
sync-repository:
92+
name: "Sync Repository"
93+
needs: sonatype-release
94+
runs-on: ubuntu-18.04
95+
steps:
96+
- name: "Checkout main branch"
97+
uses: actions/checkout@v2
98+
with:
99+
fetch-depth: 0
100+
repository: ${{ github.repository }}
101+
token: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
102+
ref: main
103+
- name: "Merge release branch into main branch"
104+
if: ${{ github.event.inputs.dryRun == 'false' }}
105+
run: |
106+
git pull origin release/${{ github.run_number }}
107+
- name: "Push release commits to main branch"
108+
if: ${{ github.event.inputs.dryRun == 'false'}}
109+
run: |
110+
git push origin HEAD:main
111+
git push origin HEAD:development
112+
- name: "Delete release branch"
113+
if: ${{ github.event.inputs.dryRun == 'false' }}
114+
run: |
115+
git push --delete origin release/${{ github.run_number }}
116+
91117
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<img src="https://static.mparticle.com/sdk/mp_logo_black.svg" width="280"><br>
2+
3+
# The Higgs Shop Sample App
4+
5+
The Higgs Shop is an example app that implements the mParticle Android SDK to highlight the features and implementation details of the respective SDKs.
6+
7+
The purpose of the app is to highlight the following features:
8+
9+
- Creating an instance of the mParticle Android SDK
10+
- Setting up an optimal mParticle Configuration with debugging
11+
- Sending events and custom attributes to mParticle
12+
13+
## Getting Started
14+
15+
1. In this repo, open a sample app (inside samples folder) in Android Studio
16+
17+
2. Update the `HIGGS_SHOP_SAMPLE_APP_KEY` variable with your mParticle Android API Key inside app/build.gradle.kts file
18+
19+
- Visit your [mParticle Workspace](https://app.mparticle.com/setup/inputs/apps) to generate API Credentials
20+
21+
3. Run the project in Android emulator. This will open the Higgs Shop Sample App
22+
23+
### API Credentials
24+
25+
**NOTE** These Sample Apps require a mParticle account with an API key and Secret.
26+
27+
While the code might run and build without mParticle credentials, the SDKs will not upload events to our servers and will generate errors.
28+
29+
Please visit https://docs.mparticle.com/ for more details on setting up an API Key.
30+
31+
## Support
32+
33+
34+
35+
## License
36+
37+
The mParticle Web SDK is available under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). See the LICENSE file for more info.

core-sdk-samples/higgs-shop-sample-app/app/build.gradle.kts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,32 @@ android {
1717
versionCode = buildVersionCode()
1818
versionName = "0.1.0-SNAPSHOT"
1919
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
20+
buildConfigField("String", "HIGGS_SHOP_SAMPLE_APP_KEY", "\"${System.getenv("HIGGS_SHOP_SAMPLE_APP_KEY")}\"")
21+
buildConfigField("String", "HIGGS_SHOP_SAMPLE_APP_SECRET", "\"${System.getenv("HIGGS_SHOP_SAMPLE_APP_SECRET")}\"")
2022
}
2123

2224
buildTypes {
2325
getByName("release") {
2426
isMinifyEnabled = false
2527
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
2628
}
29+
getByName("debug") {
30+
isMinifyEnabled = false
31+
}
2732
}
2833
}
2934

3035
dependencies {
3136
implementation("androidx.core:core-ktx:1.7.0")
37+
implementation("androidx.constraintlayout:constraintlayout:2.1.3")
3238
implementation("androidx.appcompat:appcompat:1.4.1")
3339
implementation("com.google.android.material:material:1.5.0")
34-
implementation("androidx.constraintlayout:constraintlayout:2.1.3")
35-
testImplementation("junit:junit:4.13.2")
40+
41+
implementation("com.mparticle:android-core:5.35.2")
42+
3643
androidTestImplementation("androidx.test.ext:junit:1.1.3")
3744
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
45+
testImplementation("junit:junit:4.13.2")
3846
}
3947

4048
fun buildVersionCode(): Int {

core-sdk-samples/higgs-shop-sample-app/app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.mparticle.example.higgsshopsampleapp">
44

5+
<uses-permission android:name="android.permission.INTERNET"/>
6+
57
<application
8+
android:name=".HiggsShopSampleApplication"
69
android:allowBackup="true"
710
android:icon="@mipmap/ic_launcher"
811
android:label="@string/app_name"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.mparticle.example.higgsshopsampleapp;
2+
3+
import android.app.Application
4+
import android.util.Log
5+
import com.mparticle.MParticle
6+
import com.mparticle.MParticleOptions
7+
import com.mparticle.example.higgsshopsampleapp.BuildConfig
8+
9+
10+
class HiggsShopSampleApplication: Application() {
11+
val TAG = "HiggsShopSampleApplication"
12+
override fun onCreate() {
13+
super.onCreate()
14+
val options: MParticleOptions = MParticleOptions.builder(this)
15+
.credentials(BuildConfig.HIGGS_SHOP_SAMPLE_APP_KEY, BuildConfig.HIGGS_SHOP_SAMPLE_APP_SECRET)
16+
.build()
17+
18+
MParticle.start(options)
19+
}
20+
21+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

gradlew

Lines changed: 234 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)