Skip to content

Instantly share code, notes, and snippets.

@tfaki
Created October 14, 2022 06:58
Show Gist options
  • Save tfaki/63f36f940494d0b34eabb3af73341300 to your computer and use it in GitHub Desktop.
Save tfaki/63f36f940494d0b34eabb3af73341300 to your computer and use it in GitHub Desktop.
override fun onUserLeaveHint() {
super.onUserLeaveHint()
//when user presses home button, if not in PIP mode, enter in PIP, requires Android N and above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){
Log.d(TAG, "onUserLeaveHint: was not in PIP")
pictureInPictureMode()
}
else{
Log.d(TAG, "onUserLeaveHint: Already in PIP")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment