Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
apply plugin: 'com.android.application'
dependencies {
def appCenterSdkVersion = '4.1.0'
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
}

android {
compileSdkVersion 29
Expand All @@ -11,9 +16,9 @@ android {
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// Obtain the value of APPCENTER_APP_SECRET environment variable from Build time.
buildConfigField("String", "APPCENTER_APP_SECRET", "\"\"")
if (System.getenv("APPCENTER_APP_SECRET") != null) {
buildConfigField("String", "APPCENTER_APP_SECRET", "\"${System.getenv("APPCENTER_APP_SECRET")}\"")
buildConfigField("String", "a5c9f863-ae47-481c-99b0-a1f8d74906cd", "\"\"")
if (System.getenv("a5c9f863-ae47-481c-99b0-a1f8d74906cd") != null) {
buildConfigField("String", "a5c9f863-ae47-481c-99b0-a1f8d74906cd", "\"${System.getenv("a5c9f863-ae47-481c-99b0-a1f8d74906cd")}\"")
}
}
buildTypes {
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ms.appcenter.sampleapp.android">
package="com.example.cupidclientsignin">

<application
android:allowBackup="true"
Expand All @@ -10,7 +10,7 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name="ms.appcenter.sampleapp.android.MainActivity"
android:name="com.example.cupidclientsignin.MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar">
Expand All @@ -20,4 +20,4 @@
</intent-filter>
</activity>
</application>
</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_root);

// Initialize SDK
if (!BuildConfig.APPCENTER_APP_SECRET.equals("")) {
if (!BuildConfig.APPCENTER_APP_SECRET.equals("a5c9f863-ae47-481c-99b0-a1f8d74906cd")) {
// Use APPCENTER_APP_SECRET environment variable if it exists
AppCenter.start(getApplication(), BuildConfig.APPCENTER_APP_SECRET,
Analytics.class, Crashes.class, Distribute.class);
} else {
// Otherwise use the hardcoded string value here
AppCenter.start(getApplication(), "<APP SECRET HERE>",
AppCenter.start(getApplication(), "<a5c9f863-ae47-481c-99b0-a1f8d74906cd>",
Analytics.class, Crashes.class, Distribute.class);
}

Expand Down Expand Up @@ -98,4 +98,4 @@ public CharSequence getPageTitle(@IntRange(from = 0, to = 6) final int position)
return views[position].getClass().getSimpleName().trim().replace("Activity", "");
}
}
}
}