-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(and): move to background on exit
- Loading branch information
Showing
3 changed files
with
70 additions
and
18 deletions.
There are no files selected for viewing
6 changes: 0 additions & 6 deletions
6
android/app/src/main/kotlin/com/example/waitress/MainActivity.kt
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
android/app/src/main/kotlin/com/tuihub/waiter/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.tuihub.waiter | ||
|
||
import android.os.Bundle | ||
import io.flutter.embedding.android.FlutterActivity | ||
import io.flutter.embedding.engine.FlutterEngine | ||
import io.flutter.plugin.common.MethodChannel | ||
|
||
class MainActivity: FlutterActivity() { | ||
// Temporary fix for https://github.com/flutter/flutter/issues/117061 | ||
override fun configureFlutterEngine(flutterEngine: FlutterEngine) { | ||
super.configureFlutterEngine(flutterEngine) | ||
|
||
val binaryMessenger = flutterEngine.dartExecutor.binaryMessenger | ||
|
||
MethodChannel(binaryMessenger, "com.tuihub.waiter/app_retain").apply { | ||
setMethodCallHandler { method, result -> | ||
if (method.method == "sendToBackground") { | ||
moveTaskToBack(true) | ||
result.success(null) | ||
} else { | ||
result.notImplemented() | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters