diff --git a/app/src/main/java/com/anthonyla/paperize/App.kt b/app/src/main/java/com/anthonyla/paperize/App.kt index 0d68e12..3dda95f 100644 --- a/app/src/main/java/com/anthonyla/paperize/App.kt +++ b/app/src/main/java/com/anthonyla/paperize/App.kt @@ -16,6 +16,24 @@ import java.lang.reflect.Field class App: Application() { override fun onCreate() { super.onCreate() + + // Increase CursorWindow size to handle large datasets + // Default is usually 2MB, increasing to 10MB + try { + val field: Field = CursorWindow::class.java.getDeclaredField("sCursorWindowSize") + field.isAccessible = true + field.set(null, 10 * 1024 * 1024) // 10MB + } catch (e: Exception) { + // Fallback for newer Android versions where field might be different + try { + val field: Field = CursorWindow::class.java.getDeclaredField("CURSOR_WINDOW_SIZE") + field.isAccessible = true + field.set(null, 10 * 1024 * 1024) // 10MB + } catch (e2: Exception) { + e2.printStackTrace() + } + } + val channel = NotificationChannel("wallpaper_service_channel", "Paperize", NotificationManager.IMPORTANCE_LOW) val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager notificationManager.createNotificationChannel(channel)