Youtube API ActivityNotFoundException on Gingerbread

前端 未结 6 1892
悲&欢浪女
悲&欢浪女 2021-01-12 14:20

I am getting ActivityNotFoundException error when i am trying to run youtube api StandAlonePlayerActivity on ginger bread. Where as it runs fine on ICS

here is my l

6条回答
  •  清酒与你
    2021-01-12 14:54

    I would suggest some improvements to @Nikola answer. It's possible to show localised dialog getErrorDialog() to handle some user-recoverable errors isUserRecoverableError. For example, when YouTube app is disabled in Settings.

    val result = YouTubeApiServiceUtil.isYouTubeApiServiceAvailable(context)
    when {
        result == YouTubeInitializationResult.SUCCESS -> startYouTubeActivity()
        result.isUserRecoverableError -> result.getErrorDialog(activity, 0).show()
        else -> toast("Something went wrong!")
    }
    

提交回复
热议问题