Skip to content

Instantly share code, notes, and snippets.

@sergicastellsague
Last active May 13, 2023 08:29
Show Gist options
  • Save sergicastellsague/e48dc1d0dafbb853ae2e8a50b25f258b to your computer and use it in GitHub Desktop.
Save sergicastellsague/e48dc1d0dafbb853ae2e8a50b25f258b to your computer and use it in GitHub Desktop.
Belongs to medium article
class MainActivity : FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
GeneratedPluginRegistrant.registerWith(this)
MethodChannel(flutterView, "android_app_retain").apply {
setMethodCallHandler { method, result ->
if (method.method == "sendToBackground") {
moveTaskToBack(true)
}
}
}
}
}
@luohao123
Copy link

this was wrong, causing to use for new comer user. the code was not work at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment