Nickthegoatboy Nickthegoatboy - 4 months ago 7x
Android Question

Android App stop playing YouTube video

Okay, I made a Android app to load a website which has YouTube videos on it. I just used the

myWebView.setWebViewClient(new WebViewClient());
command to create a webviewer. That aspect was working great since I didn't want to have to learn how to use the YouTube API and work it into the app. All was going well until I received an email from Google saying they pulled my app off the market because it played YouTube videos in the background, which I hadn't even thought of. My question is, how do I stop this from happening? I don't really want to kill the app when focus is lost since I want them to stay where they were in the app, so is there any other way around it?

Thanks in advance!


These did the trick.

@Override public void onStop() { super.onStop(); myWebView.destroy(); finish(); } @Override public void onPause() { super.onPause(); myWebView.destroy(); finish(); }