Skip to content

Commit

Permalink
Tidy up application behaviour
Browse files Browse the repository at this point in the history
Two changes here:

1. Clicking to stop the foreground service now exits the application.
2. The MainActivity launchMode is now singleTask.

Combined, these two gives a slightly more obvious behaviour when
starting the application and running it via intents.
  • Loading branch information
davecraig committed Aug 1, 2024
1 parent a809a80 commit 00d84f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
android:exported="true"
android:theme="@style/SplashTheme.Soundscape">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ class MainActivity : AppCompatActivity() {
} else {
// service is already running, stop it
soundscapeService?.stopForegroundService()
// And exit application
finishAndRemoveTask()
}
}

Expand Down

0 comments on commit 00d84f0

Please sign in to comment.