Skip to content

Commit

Permalink
[android] Init Reaper manually (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
chromy authored Mar 4, 2025
1 parent f13677d commit 5219a6f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ dependencies {
implementation(libs.androidx.shapes)
implementation(libs.androidx.browser)
implementation(libs.androidx.datastore)
implementation(libs.androidx.startup)

implementation(libs.extendedspans)

Expand Down
11 changes: 11 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@
android:theme="@style/Theme.HackerNews"
tools:targetApi="31">

<!-- This demonstrates manual initialization of Reaper.
See https://docs.emergetools.com/docs/reaper-setup-android#disable-automatic-initialization -->
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="merge">
<meta-data android:name="com.emergetools.reaper.ReaperInitializer"
tools:node="remove" />
</provider>

<meta-data
android:name="io.sentry.dsn"
android:value="https://[email protected]/4506028523388928" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.emergetools.hackernews.data.local.UserStorage
import com.emergetools.hackernews.data.remote.HackerNewsBaseClient
import com.emergetools.hackernews.data.remote.HackerNewsSearchClient
import com.emergetools.hackernews.data.remote.HackerNewsWebClient
import com.emergetools.reaper.Reaper
import kotlinx.serialization.json.Json
import okhttp3.OkHttpClient
import java.time.Duration
Expand All @@ -31,6 +32,10 @@ class HackerNewsApplication : Application() {
override fun onCreate() {
super.onCreate()

// This demonstrates manual initialization of Reaper.
// See https://docs.emergetools.com/docs/reaper-setup-android#manual-initialization
Reaper.init(applicationContext)

val db = Room.databaseBuilder(
applicationContext,
HackerNewsDatabase::class.java,
Expand Down
2 changes: 2 additions & 0 deletions android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ sentry = "5.3.0"
shapes = "1.0.1"
datastore = "1.1.3"
room = "2.6.1"
startup = "1.2.0"
jsoup = "1.19.1"
extendedspans = "1.4.0"
composeBom = "2025.02.00"
Expand All @@ -38,6 +39,7 @@ androidx-navigation = { group = "androidx.navigation", name = "navigation-compos
androidx-browser = { group = "androidx.browser", name = "browser", version.ref = "browser" }
androidx-shapes = { group = "androidx.graphics", name = "graphics-shapes", version.ref = "shapes" }
androidx-datastore = { group = "androidx.datastore", name = "datastore-preferences", version.ref = "datastore" }
androidx-startup = { group = "androidx.startup", name = "startup-runtime", version.ref = "startup" }
androidx-room = { group = "androidx.room", name = "room-runtime", version.ref = "room" }
androidx-room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "room" }
androidx-room-ktx = { group = "androidx.room", name = "room-ktx", version.ref = "room" }
Expand Down

0 comments on commit 5219a6f

Please sign in to comment.