mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2026-01-06 00:04:21 +01:00
Add Firebase gradle configuration
This commit is contained in:
7
lib_analytics/src/main/AndroidManifest.xml
Normal file
7
lib_analytics/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
</manifest>
|
||||
@@ -0,0 +1,20 @@
|
||||
package no.nordicsemi.android.analytics
|
||||
|
||||
import android.content.Context
|
||||
import com.google.firebase.analytics.FirebaseAnalytics
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class AppAnalytics @Inject constructor(
|
||||
@ApplicationContext
|
||||
private val context: Context
|
||||
) {
|
||||
|
||||
private val firebase by lazy { FirebaseAnalytics.getInstance(context) }
|
||||
|
||||
fun logEvent(event: ProfileOpenEvent) {
|
||||
firebase.logEvent(event.firebaseName, null)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package no.nordicsemi.android.analytics
|
||||
|
||||
enum class ProfileOpenEvent(internal val firebaseName: String) {
|
||||
BPS("BPS_PROFILE_OPEN"),
|
||||
CGMS("CGMS_PROFILE_OPEN"),
|
||||
CSC("CSC_PROFILE_OPEN"),
|
||||
GLS("GLS_PROFILE_OPEN"),
|
||||
HRS("HRS_PROFILE_OPEN"),
|
||||
HTS("HTS_PROFILE_OPEN"),
|
||||
PRX("PRX_PROFILE_OPEN"),
|
||||
RSCS("RSCS_PROFILE_OPEN"),
|
||||
UART("UART_PROFILE_OPEN"),
|
||||
|
||||
DFU("DFU_PROFILE_OPEN"),
|
||||
LOGGER("LOGGER_PROFILE_OPEN"),
|
||||
}
|
||||
Reference in New Issue
Block a user