Skip to content

Commit

Permalink
Add HMS Analytics and Crash report
Browse files Browse the repository at this point in the history
  • Loading branch information
alvareztech committed Jun 3, 2020
1 parent 4bedc80 commit c61e484
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ dependencies {
implementation 'com.google.firebase:firebase-analytics-ktx:17.4.2'

implementation 'com.huawei.hms:hianalytics:5.0.0.301'
implementation 'com.huawei.agconnect:agconnect-crash:1.2.1.300'

implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/java/tech/alvarez/facts/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@ package tech.alvarez.facts

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.huawei.hms.analytics.HiAnalytics
import com.huawei.hms.analytics.HiAnalyticsInstance
import com.huawei.hms.analytics.HiAnalyticsTools

class MainActivity : AppCompatActivity() {

var instance: HiAnalyticsInstance? = null

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

HiAnalyticsTools.enableLog();
instance = HiAnalytics.getInstance(this);
instance?.setAnalyticsEnabled(true)
}
}
1 change: 0 additions & 1 deletion app/src/main/java/tech/alvarez/facts/info/InfoViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class InfoViewModel(private val category: Category) : ViewModel() {
val information: MutableLiveData<List<Info>> = MutableLiveData<List<Info>>()

fun reloadInformation() {
information.value = deviceInfo()
when (category) {
Category.DEVICE -> information.value = deviceInfo()
Category.GMS -> information.value = gmsInfo
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/tech/alvarez/facts/util/Device.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import androidx.core.app.ActivityCompat
import tech.alvarez.facts.App
import tech.alvarez.facts.Message


class Device {
companion object {
fun manufacturer(): String = Build.MANUFACTURER
Expand Down

0 comments on commit c61e484

Please sign in to comment.