I recently submitted an Ionic app to the Google Play Store which was rejected due to background play with Youtube videos (when you press the power button or lock screen is applied, the video continues to play int he background. Which Play Store will not allow)
A possible fix has been found at Stop android app audio playing when device locked
But I am unsure where to apply this within the platforms/android folder.
Does anyone know which file and where to apply the code? The image below shows files that featured the onPause override, so I assume it is one of those.
Android .java files containing onPause Overrides
@Override
public void onPause() {
super.onPause();
myCustomWebView.onPause();
}
myCustomWebView.setWebViewClient(new WebViewClient() {
@Override
public void onLoadResource(WebView webview, String url) {
super.onLoadResource(webview, url);
if (url.contains("youtube.com")) mShouldPause = true;
}
//...... plus any other method you want to override
});
@Override
public void onPause() {
super.onPause();
// mShouldPause is just a private boolean
if (mShouldPause) {
myCustomWebView.onPause();
}
mShouldPause = false;
}