Android Configuration
Android Configuration
To ensure Freak-Flix runs optimally on Android devices—supporting high-definition streaming, local file access, and secure authentication—follow the configuration steps below.
1. Permissions Configuration
Freak-Flix requires specific permissions to fetch metadata, stream from cloud providers (OneDrive), and scan local media.
Update your android/app/src/main/AndroidManifest.xml to include the following:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Internet access for TMDB, AniList, StashDB, and OneDrive streaming -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!-- Required for scanning and playing local video files -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<!-- Required for Android 13+ (API 33+) local media access -->
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
<!-- Keeps the screen on during video playback -->
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<application ...>
<!-- Ensure hardware acceleration is enabled for smooth video playback -->
<activity
android:name=".MainActivity"
android:hardwareAccelerated="true"
...>
<!-- (Optional) Deep Linking for OneDrive/Auth0 Authentication -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="freakflix" android:host="auth" />
</intent-filter>
</activity>
</application>
</manifest>
2. Build Requirements (Gradle)
The media engine used by Freak-Flix requires a minimum SDK version of 21 (Android 5.0).
Modify android/app/build.gradle:
android {
defaultConfig {
// Required for media_kit and modern video codecs
minSdkVersion 21
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
3. Audio & Video Optimization
Freak-Flix utilizes media_kit for high-performance playback. To prevent the OS from killing the playback service when the app is minimized, ensure your MainActivity.kt (located in android/app/src/main/kotlin/.../) is correctly configured to handle Flutter's engine lifecycle.
package com.mndl27.freak_flix
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
// Standard FlutterActivity is sufficient for most builds.
// If implementing custom Picture-in-Picture (PiP), override
// onUserLeaveHint or onPictureInPictureModeChanged here.
}
4. Release Build Configuration (ProGuard/R8)
If you are building the APK or App Bundle for production, you must prevent R8/ProGuard from obfuscating the native media classes and the backend models.
Add the following to android/app/proguard-rules.pro:
# Preserve Flutter and Media Kit classes
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class com.alexmercerind.mediakit.** { *; }
# Preserve models for JSON serialization (TMDB/StashDB)
-keep class com.mndl27.freak_flix.models.** { *; }
Enable ProGuard in your android/app/build.gradle:
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
5. Deployment
To build and install the app on a connected device or emulator:
# Debug mode
flutter run -d android
# Generate a release APK
flutter build apk --release
# Generate an App Bundle for Google Play
flutter build appbundle