Sunday, February 23, 2014

A phone idle state broadcasting issues


Question: Sony phones with testing, ringing and call state has printed that state does not hang up. Permissions added, seeking prawn instructions, ado the code


 public void onReceive (Context context, Intent intent) {


TelephonyManager tm = (TelephonyManager) context
. GetSystemService (Service.TELEPHONY_SERVICE);
switch (tm.getCallState ()) {
case TelephonyManager.CALL_STATE_RINGING: / / Bell
log.d ("msg", "ringing");
break;

case TelephonyManager.CALL_STATE_OFFHOOK :/ / call
log.d ("msg", "call");
break;

case TelephonyManager.CALL_STATE_IDLE:
log.d ("msg", "hang up");
break;



}



<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Great God seek guidance online. . .
Reply:
Try this:
 public class CustomPhoneStateListener extends PhoneStateListener {
public void onCallStateChanged (int state, String incomingNumber)
{
switch (state)
{
case TelephonyManager.CALL_STATE_RINGING:
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
break;
case TelephonyManager.CALL_STATE_IDLE:
break;
}
}
}

Reply:
reference to the second floor mdcire reply:
Try this:
 public class CustomPhoneStateListener extends PhoneStateListener {
public void onCallStateChanged (int state, String incomingNumber)
{
switch (state)
{
case TelephonyManager.CALL_STATE_RINGING:
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
break;
case TelephonyManager.CALL_STATE_IDLE:
break;
}
}
}



That why the first two states will do it. . . .

No comments:

Post a Comment