本文整理汇总了Java中android.telephony.TelephonyManager.CALL_STATE_IDLE属性的典型用法代码示例。如果您正苦于以下问题:Java TelephonyManager.CALL_STATE_IDLE属性的具体用法?Java TelephonyManager.CALL_STATE_IDLE怎么用?Java TelephonyManager.CALL_STATE_IDLE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.telephony.TelephonyManager
的用法示例。
在下文中一共展示了TelephonyManager.CALL_STATE_IDLE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCallStateChanged
@Override
public void onCallStateChanged(int state, String incomingNumber) {
switch (state) {
case TelephonyManager.CALL_STATE_IDLE:
Log.d(TAG, "CALL_STATE_IDLE");
if(mPlayerEngine != null && !mPlayerEngine.isPlaying() && !pauseFromUser) {
mPlayerEngine.resume();
}
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
Log.d(TAG, "CALL_STATE_OFFHOOK");
case TelephonyManager.CALL_STATE_RINGING:
Log.d(TAG, "CALL_STATE_RINGING");
if(mPlayerEngine != null && mPlayerEngine.isPlaying()) {
mPlayerEngine.pause();
}
break;
}
}
示例2: onCallStateChanged
@Override
public void onCallStateChanged(int state, String incomingNumber)
{
switch (state)
{
case TelephonyManager.CALL_STATE_RINGING:
case TelephonyManager.CALL_STATE_OFFHOOK:
if (downloadService.getPlayerState() == PlayerState.STARTED && !downloadService.isJukeboxEnabled())
{
resumeAfterCall = true;
downloadService.pause();
}
break;
case TelephonyManager.CALL_STATE_IDLE:
if (resumeAfterCall)
{
resumeAfterCall = false;
downloadService.start();
}
break;
default:
break;
}
}
示例3: onCallStateChanged
@Override
public void onCallStateChanged(int state, String incomingNumber) {
super.onCallStateChanged(state, incomingNumber);
switch (state) {
// 电话挂断
case TelephonyManager.CALL_STATE_IDLE:
resume();
break;
// 等待接电话
case TelephonyManager.CALL_STATE_RINGING:
pause();
break;
// 通话中
case TelephonyManager.CALL_STATE_OFFHOOK:
break;
default:
break;
}
}
示例4: onCallStateChanged
public void onCallStateChanged(String state) {
Log.i(TAG, "onCallStateChanged, now state =" + state);
stateEnum = PhoneCallStateEnum.IDLE;
if (TelephonyManager.EXTRA_STATE_IDLE.equals(state)) {
phoneState = TelephonyManager.CALL_STATE_IDLE;
stateEnum = PhoneCallStateEnum.IDLE;
} else if (TelephonyManager.EXTRA_STATE_RINGING.equals(state)) {
phoneState = TelephonyManager.CALL_STATE_RINGING;
stateEnum = PhoneCallStateEnum.INCOMING_CALL;
} else if (TelephonyManager.EXTRA_STATE_OFFHOOK.equals(state)) {
int lastPhoneState = phoneState;
phoneState = TelephonyManager.CALL_STATE_OFFHOOK;
if (lastPhoneState == TelephonyManager.CALL_STATE_IDLE) {
stateEnum = PhoneCallStateEnum.DIALING_OUT;
} else if (lastPhoneState == TelephonyManager.CALL_STATE_RINGING) {
stateEnum = PhoneCallStateEnum.DIALING_IN;
}
}
handleLocalCall();
}
示例5: onCallStateChanged
@Override
public void onCallStateChanged(int state, String incomingNumber) {
Status afspilningsstatus = afspiller.getAfspillerstatus();
Log.d("Opkaldshaandtering " + state + " afspilningsstatus=" + afspilningsstatus+" nummer="+incomingNumber);
switch (state) {
case TelephonyManager.CALL_STATE_OFFHOOK:
case TelephonyManager.CALL_STATE_RINGING:
Log.d("Opkald i gang");
if (afspilningsstatus != Status.STOPPET) {
venterPåKaldetAfsluttes = true;
afspiller.pauseAfspilning();
}
break;
case TelephonyManager.CALL_STATE_IDLE:
Log.d("Idle state detected");
if (venterPåKaldetAfsluttes) {
try {
afspiller.startAfspilning();
} catch (Exception e) {
Log.e(e);
}
venterPåKaldetAfsluttes = false;
}
}
}
示例6: createAndStart
public synchronized static final LinphoneManager createAndStart(Context c) {
if (instance != null)
throw new RuntimeException("Linphone Manager is already initialized");
instance = new LinphoneManager(c);
instance.startLibLinphone(c);
TelephonyManager tm = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE);
boolean gsmIdle = tm.getCallState() == TelephonyManager.CALL_STATE_IDLE;
setGsmIdle(gsmIdle);
return instance;
}
示例7: callStateListener
/**
* Handle PhoneState changes
*/
private void callStateListener() {
// Get the telephony manager
telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
//Starting listening for PhoneState changes
phoneStateListener = new PhoneStateListener() {
@Override
public void onCallStateChanged(int state, String incomingNumber) {
switch (state) {
//if at least one call exists or the phone is ringing
//pause the MediaPlayer
case TelephonyManager.CALL_STATE_OFFHOOK:
case TelephonyManager.CALL_STATE_RINGING:
if (mediaPlayer != null) {
pauseMedia();
ongoingCall = true;
}
break;
case TelephonyManager.CALL_STATE_IDLE:
// Phone idle. Start playing.
if (mediaPlayer != null) {
if (ongoingCall) {
ongoingCall = false;
resumeMedia();
}
}
break;
}
}
};
// Register the listener with the telephony manager
// Listen for changes to the device call state.
telephonyManager.listen(phoneStateListener,
PhoneStateListener.LISTEN_CALL_STATE);
}
示例8: phoneCallStateUpdated
@Override
public void phoneCallStateUpdated(int state, String phoneNumber) {
jsModule = this.reactContext.getJSModule(CallStateUpdateActionModule.class);
switch (state) {
//Hangup
case TelephonyManager.CALL_STATE_IDLE:
if(wasAppInRinging == true ) {
if(wasAppInOffHook == true) {
jsModule.callStateUpdated("Disconnected", null);
} else {
jsModule.callStateUpdated("Missed", null);
}
}
wasAppInRinging = false;
wasAppInOffHook = false;
// Device call state: No activity.
break;
//Outgoing
case TelephonyManager.CALL_STATE_OFFHOOK:
//Device call state: Off-hook. At least one call exists that is dialing, active, or on hold, and no calls are ringing or waiting.
wasAppInOffHook = true;
jsModule.callStateUpdated("Offhook", null);
break;
//Incoming
case TelephonyManager.CALL_STATE_RINGING:
// Device call state: Ringing. A new call arrived and is ringing or waiting. In the latter case, another call is already active.
wasAppInRinging = true;
jsModule.callStateUpdated("Incoming", phoneNumber);
break;
}
}
开发者ID:priteshrnandgaonkar,项目名称:react-native-call-detection,代码行数:33,代码来源:CallDetectionManagerModule.java
示例9: onCallStateChanged
@Override
public void onCallStateChanged(int state, String incomingNumber) {
if (state == TelephonyManager.CALL_STATE_RINGING) {
//Incoming call: Pause music
pause();
} else if (state == TelephonyManager.CALL_STATE_IDLE) {
//Not in call: Play music
play();
} else if (state == TelephonyManager.CALL_STATE_OFFHOOK) {
//A call is dialing, active or on hold
}
super.onCallStateChanged(state, incomingNumber);
}
示例10: isBusy
private boolean isBusy() {
TelephonyManager telephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
return callState != CallState.STATE_IDLE || telephonyManager.getCallState() != TelephonyManager.CALL_STATE_IDLE;
}
示例11: onCreate
@Override
public void onCreate() {
audioStreamingManager = AudioStreamingManager.getInstance(AudioStreamingService.this);
audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
NotificationManager.getInstance().addObserver(this, NotificationManager.audioProgressDidChanged);
NotificationManager.getInstance().addObserver(this, NotificationManager.setAnyPendingIntent);
NotificationManager.getInstance().addObserver(this, NotificationManager.audioPlayStateChanged);
try {
phoneStateListener = new PhoneStateListener() {
@Override
public void onCallStateChanged(int state, String incomingNumber) {
if (state == TelephonyManager.CALL_STATE_RINGING) {
if (audioStreamingManager.isPlaying()) {
audioStreamingManager.handlePauseRequest();
}
} else if (state == TelephonyManager.CALL_STATE_IDLE) {
} else if (state == TelephonyManager.CALL_STATE_OFFHOOK) {
}
super.onCallStateChanged(state, incomingNumber);
}
};
TelephonyManager mgr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
if (mgr != null) {
mgr.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
}
} catch (Exception e) {
Log.e("tmessages", e.toString());
}
super.onCreate();
}
示例12: onCallStateChanged
@Override
public void onCallStateChanged(final int state, final String incomingNumber) {
super.onCallStateChanged(state, incomingNumber);
switch (state) {
case TelephonyManager.CALL_STATE_OFFHOOK:
if (DEBUG) {
MyLog.i(CLS_NAME, "PhoneStateListener: TelephonyManager.CALL_STATE_OFFHOOK");
}
interrupt();
break;
case TelephonyManager.CALL_STATE_RINGING:
if (DEBUG) {
MyLog.i(CLS_NAME, "PhoneStateListener: TelephonyManager.CALL_STATE_RINGING: " + incomingNumber);
}
interrupt();
break;
case TelephonyManager.CALL_STATE_IDLE:
if (DEBUG) {
MyLog.i(CLS_NAME, "PhoneStateListener: TelephonyManager.CALL_STATE_IDLE");
}
if (conditions.restartHotword()) {
startHotwordDetection(conditions.getBundle());
}
conditions.removeInterrupted(params);
break;
}
}
示例13: onCallStateChanged
public void onCallStateChanged(int state, String incomingNumber) {
super.onCallStateChanged(state, incomingNumber);
if (state != TelephonyManager.CALL_STATE_IDLE) {
mutePlayer();
} else {
unmutePlayer();
}
}
示例14: getTelephoneCallState
public String getTelephoneCallState(Context context)
{
try
{
int currentState = TelephoneCallReceiver.getCurrentState();
String telephoneCallState = "";
switch (currentState)
{
case TelephonyManager.CALL_STATE_IDLE:
telephoneCallState = context.getString(R.string.monitoring_telephone_call_state_idle);
break;
case TelephonyManager.CALL_STATE_RINGING:
telephoneCallState = context.getString(R.string.monitoring_telephone_call_state_ringing);
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
telephoneCallState = context.getString(R.string.monitoring_telephone_call_state_offhook);
break;
}
return telephoneCallState;
}
catch (Exception e)
{
return "";
}
}
示例15: CheckCalling
private boolean CheckCalling() {
TelephonyManager telephonyService = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
return telephonyService == null || telephonyService.getCallState() == TelephonyManager.CALL_STATE_IDLE;
}