Browse Source

Divers

master
Samuel Vermeulen 3 months ago
parent
commit
0d82e3650c
  1. 8
      app/src/main/java/fr/svpro/radiomercure/MediaPlayerService.java

8
app/src/main/java/fr/svpro/radiomercure/MediaPlayerService.java

@ -238,8 +238,7 @@ public class MediaPlayerService extends Service implements MediaPlayer.OnComplet
@Override
public void onCallStateChanged(int state, String incomingNumber) {
switch (state) {
//if at least one call exists or the phone is ringing
//pause the MediaPlayer
//A la sonnerie suspendre la lecture
case TelephonyManager.CALL_STATE_OFFHOOK:
case TelephonyManager.CALL_STATE_RINGING:
if (mediaPlayer != null) {
@ -248,7 +247,7 @@ public class MediaPlayerService extends Service implements MediaPlayer.OnComplet
}
break;
case TelephonyManager.CALL_STATE_IDLE:
// Phone idle. Start playing.
// Fin de communication, reprendre lecture
if (mediaPlayer != null) {
if (ongoingCall) {
ongoingCall = false;
@ -259,8 +258,7 @@ public class MediaPlayerService extends Service implements MediaPlayer.OnComplet
}
}
};
// Register the listener with the telephony manager
// Listen for changes to the device call state.
//Surveillance état tel
telephonyManager.listen(phoneStateListener,
PhoneStateListener.LISTEN_CALL_STATE);
}

Loading…
Cancel
Save