We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It was a major issue and I fixed as follows
File: PlaybackService.java
TelephonyManager telManager; boolean wasPlayingBeforePhoneCall=false;
public class LocalBinder extends Binder { public PlaybackService getService() { return PlaybackService.this; } } @Override public void onCreate() { super.onCreate(); mPlayer = com.aapbd.mediaplayeraudio.player.Player.getInstance(); mPlayer.registerCallback(this); telManager = (TelephonyManager)this.getSystemService(TELEPHONY_SERVICE); if (telManager != null) { telManager.listen(phoneListener, PhoneStateListener.LISTEN_CALL_STATE); } } PhoneStateListener phoneListener = new PhoneStateListener() { @Override public void onCallStateChanged(int state, String incomingNumber) { if (state == TelephonyManager.CALL_STATE_RINGING) { if(mPlayer==null) return; wasPlayingBeforePhoneCall = isPlaying(); pause(); } else if (state == TelephonyManager.CALL_STATE_IDLE) { if(mPlayer==null) return; if (wasPlayingBeforePhoneCall) { play(); } } else if (state == TelephonyManager.CALL_STATE_OFFHOOK) { // A call is dialing, // active or on hold if(mPlayer==null) return; wasPlayingBeforePhoneCall = isPlaying(); pause(); } super.onCallStateChanged(state, incomingNumber); } };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
It was a major issue and I fixed as follows
File: PlaybackService.java
TelephonyManager telManager;
boolean wasPlayingBeforePhoneCall=false;
The text was updated successfully, but these errors were encountered: