Reputation: 327
I am trying to embed a youtube video in an android app using the Youtube API. I imported the jar, added it to my build path, and added a YouTubePlayerView to my main view. In the onCreate I have the following code with my key where xxxx is :
YoutubePlayerView ytpv = (YouTubePlayerView) findViewById(R.id.youtubeplayer);
ytpv.initialize("xxxx", this);
When I run the app I get the exception :
java.lang.SecurityException: Not allowed to bind to service Intent { act=com.google.android.youtube.api.service.START }
When I try to run the same app that comes with the api it seems to work fine. Any ideas?
Upvotes: 16
Views: 5257
Reputation: 3189
I think you forgot to add permission:
<uses-permission android:name="android.permission.INTERNET"/>
Upvotes: 30
Reputation: 91
It is because you didn't give internet usage permission to your Android app, because you are using YouTube player you need an internet connection.
For that you need to enter one line in your manifest.xml:
uses-permission android:name="android.permission.INTERNET"
Don't forget to use tags before pasting it in manifest file.
Upvotes: 2
Reputation: 3480
Hi check your Android Manifest file whether you have declared Activity two times (or) check your service element and android Permissions are declared correctly . If error is not cleared post your java and Manifest file .
Check the below post for your reference
Upvotes: 0