Skip to content

Commit

Permalink
Android backend overhaul and fixes (roc-streaming#98)
Browse files Browse the repository at this point in the history
Also fixes: roc-streaming#1, roc-streaming#16, roc-streaming#17, roc-streaming#66

- Initiate request for notification and microphone permissions
  and media projection on the dart side of AndroidBackend.

- Implement those requests in MainActivity.kt and rework
  AndroidConnector to redirect those requests to activity.

- Automatically stop media projection when both sender and receiver
  are stopped. Prevent service from stopping projection while we
  are starting sender and receiver.

- Implement synchronization and fix various races.

- Use foreground service instead of bound service, to keep it
  running when app closes.

- Forbid swiping away notification on lock screen.
  (We can forbid it only for lock screen).

- Stop sender and receiver when notification is swiped away.

- Add AndroidListener, to pass events from kotlin to dart.
  Implement in in AndroidBackend on dart side.

- Add AndroidSenderSettings, AndroidReceiverSettings, and pass them
  from model to kotlin.

- Hard-code ports in model instead of kotlin.

- Implement Backend.getLocalAddresses().

- Improve comments.

- Refactor android service code.

- Remove unused values from strings.xml.
  • Loading branch information
gavv committed Oct 5, 2024
1 parent c448495 commit a95456d
Show file tree
Hide file tree
Showing 17 changed files with 2,037 additions and 417 deletions.
14 changes: 12 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ android {
defaultConfig {
applicationId = "org.rocstreaming.rocdroid"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
// For more information, see:
// https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutterVersionCode.toInteger()
Expand All @@ -65,6 +66,15 @@ android {
signingConfig = signingConfigs.debug
}
}

// https://android.izzysoft.de/articles/named/iod-scan-apkchecks#blobs
// https://gist.github.com/obfusk/31c332b884464cd8aa06ce1ba1583c05
dependenciesInfo {
// Disables dependency metadata when building APKs.
includeInApk = false
// Disables dependency metadata when building Android App Bundles.
includeInBundle = false
}
}

flutter {
Expand All @@ -76,7 +86,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.activity:activity-ktx:1.2.4'
implementation 'androidx.activity:activity-ktx:1.9.2'
implementation 'androidx.fragment:fragment-ktx:1.3.6'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.3.0'
Expand Down
17 changes: 14 additions & 3 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.rocstreaming.rocdroid"
android:versionCode="2002"
android:versionName="0.2.2">
android:versionCode="3000"
android:versionName="0.3.0">

<!-- For sreaming -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- To get list of local network interfaces -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- For sender, when capturing sound from microphone -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<!-- To continue working when app is closed -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<!-- For sender, when capturing sound from other apps -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<!-- To create notification from sender -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

<application
android:label="Roc Droid"
android:name="${applicationName}"
android:icon="@mipmap/launcher_icon">
<service
android:name=".StreamingService"
android:exported="false"
android:foregroundServiceType="mediaProjection" />
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down Expand Up @@ -43,7 +55,6 @@
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
Expand Down
Loading

0 comments on commit a95456d

Please sign in to comment.