I'm building an application that plays launches youtube videos. I'm able to launch a youtube application and video. But the problem is when the video is finished youtube app is not closed itself also, my main app also goes in the background.
@Overridepublic void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) { super.configureFlutterEngine(flutterEngine); new MethodChannel(flutterEngine.getDartExecutor().getBinaryMessenger(), CHANNEL) .setMethodCallHandler( (call, result) -> { if (call.method.equals("playVideoInNativeYoutubePlayer")) { System.out.println(call.argument("videoId").toString()); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=" + call.argument("videoId").toString())); intent.putExtra("force_fullscreen", true); intent.putExtra("finish_on_ended", true); startActivity(intent); } else { result.notImplemented(); } } );}I'm using the flutter method channel to call this method from my flutter application.I have read every post available on the internet. But no one has a solution for this.