안드로이드앱이 어느날 갑자기 게시 삭제가 되어 메일을 확인해보니



Issue: Violation of Device and Network Abuse policy 

We don’t allow apps that interfere with, disrupt, damage, or access in an unauthorized manner the user’s device, other devices or computers, servers, networks, application programming interfaces (APIs), or services, including but not limited to other apps on the device, any Google service, or an authorized carrier’s network.

Your app shouldn’t access or use the service or API in a manner that violates its terms of service. For example, your app shouldn't download, monetize, or access YouTube videos in a way that violates the YouTube Terms of Service.

Submit your app for another review

Read through the Device and Network Abuse policy and make appropriate changes to your app.
Make sure that your app is compliant with all other Developer Program Policies. Additional enforcement could occur if there are further policy violations.
Sign in to your Play Console and submit the update to your app.
If you’ve reviewed the policy and feel our decision may have been in error, please reach out to our policy support team. One of my colleagues will get back to you within 2 business days.

Thanks for your continued support of Google Play.

Best,

The Google Play Review Team


이런 내용의 메일이 와있었다.

이 내용으로만은 왜 삭제하였는지 알 수 없어 문의를 다시 하였더니 screen off(파워버튼)를 하여도 웹뷰에 있는 재생되고있는 유투브 비디오가 멈추지 않는다고

설명을 해주었다.


확인해보니 모든 앱에서 그런건 아니고 롤리팝 아래버전에서 스크린 off가 되어도 플레이되고 있던 비디오가 멈추지않고 돌아

화면은 꺼져있는데 비디오의 사운드가 계속 재생되는 문제가 보였다.




try{
    ((AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE)).requestAudioFocus(
            new AudioManager.OnAudioFocusChangeListener() {
                @Override
                public void onAudioFocusChange(int focusChange) {}
            }, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
}catch (Exception e){ }


위의 소스를 onPause() 때 넣어주니

screen off때 비디오 사운드가 들리던 문제가 해결되었다.

///////////////////////////////////////

추가) 2019.01.17

이 코드를 적용할때 문제가 발견됨.

시스템 오디오를 off시켜버림.

예를들어 멜론플레이어로 음악을 들을때, 내 앱을 사용하다가 해당 소스가 실행되면 음악이 중지됨.

적용시 주의필요.


///////////////////////////////////////

추가) 2019.02.21


오디오를 정지시킬 필요없이 아래소스를 적용하면된다. 뻘짓했네;;

@Override
public void onPause(){
    super.onPause();

    try {
       webView.onPause();
    } catch(Exception e) {}
}

pause에 정지시켰으니 마찬가지로 resume에서는 webView.onResume(); 을 꼭 시켜주자


+ Recent posts