TheFinestArtist / YouTubePlayerActivity

Android Youtube Player Activity. Simply pass a url to play youtube video in new activity. It supports screen orientation, media volume control and etc.
https://play.google.com/store/apps/details?id=com.thefinestartist.ytpa.sample
MIT License
395 stars 113 forks source link

"Get YouTube App" #26

Open Isaackingston opened 2 years ago

Isaackingston commented 2 years ago

When trying to start youtube player activity the an alert with the title "Get YouTube app" and the message as "This app won't run without the YouTube App, which is missing from your device". The alert looks like the one below. YouTube error

Isaackingston commented 2 years ago

This happens because of the privacy change in Android 11. The package visibility in Android 11 has to be explicitly requested. More information can be found in this stackoverflow link https://developer.android.com/about/versions/11/privacy/package-visibility

You can solve this by adding the following code to you AndroidManifest.xml inside the manifest element but outside the application element.

<manifest
       <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">

           </application>

          <queries>

              <intent>

                  <action android:name="com.google.android.youtube.api.service.START"/>

              </intent>

          </queries>

    </manifest>