Adds AppCenter config.
This commit is contained in:
@@ -1,3 +1,12 @@
|
|||||||
|
Properties properties = new Properties()
|
||||||
|
def propertiesFile = project.rootProject.file('local.properties')
|
||||||
|
if (propertiesFile.exists()) {
|
||||||
|
properties.load(propertiesFile.newDataInputStream())
|
||||||
|
}
|
||||||
|
def appCenterLocalSecret = properties.getProperty('appCenter.localSecret')
|
||||||
|
def appCenterEnvSecret = System.getenv('APPCENTER_SECRET')
|
||||||
|
def appCenterSecret = appCenterLocalSecret != null ? appCenterLocalSecret : appCenterEnvSecret != null ? appCenterEnvSecret : ""
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@@ -10,6 +19,7 @@ android {
|
|||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
buildConfigField "String", "APPCENTER_SECRET", "\"${appCenterSecret}\""
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
@@ -23,6 +33,10 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
def appCenterSdkVersion = '3.3.0'
|
||||||
|
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
|
||||||
|
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
|
||||||
|
|
||||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
implementation 'com.google.android.material:material:1.2.0'
|
implementation 'com.google.android.material:material:1.2.0'
|
||||||
|
|||||||
@@ -9,12 +9,23 @@ import androidx.navigation.NavController;
|
|||||||
import androidx.navigation.Navigation;
|
import androidx.navigation.Navigation;
|
||||||
import androidx.navigation.ui.AppBarConfiguration;
|
import androidx.navigation.ui.AppBarConfiguration;
|
||||||
import androidx.navigation.ui.NavigationUI;
|
import androidx.navigation.ui.NavigationUI;
|
||||||
|
import com.microsoft.appcenter.AppCenter;
|
||||||
|
import com.microsoft.appcenter.analytics.Analytics;
|
||||||
|
import com.microsoft.appcenter.crashes.Crashes;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
if (BuildConfig.APPCENTER_SECRET != null && !"".equals(BuildConfig.APPCENTER_SECRET)) {
|
||||||
|
AppCenter.start(
|
||||||
|
getApplication(),
|
||||||
|
BuildConfig.APPCENTER_SECRET,
|
||||||
|
Analytics.class,
|
||||||
|
Crashes.class
|
||||||
|
);
|
||||||
|
}
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
BottomNavigationView navView = findViewById(R.id.nav_view);
|
BottomNavigationView navView = findViewById(R.id.nav_view);
|
||||||
// Passing each menu ID as a set of Ids because each
|
// Passing each menu ID as a set of Ids because each
|
||||||
|
|||||||
Reference in New Issue
Block a user