i want to modify my IncomingCallReceiver that listens to the ACTION_PHONE_STATE_CHANGED tag. I want him to differentiate between the following five states:
(IDLE)Phone is idle -> (RINGING)first call incoming -> (OFFHOOK)first call active -> (RINGING)second call incoming - > (OFFHOOK)second call active/first call on hold
My onReceive method looks like this:
- Code: Select all
@Override
public void onReceive(Context context, Intent intent) {
this.context = context;
final Bundle extras = intent.getExtras();
if (intent.getAction().equals(
TelephonyManager.ACTION_PHONE_STATE_CHANGED)) {
final String state = extras.getString(TelephonyManager.EXTRA_STATE);
if ("IDLE".equals(state)) {
setIstate(0);
Log.i("IDLE", ""+iState);
}
if ("OFFHOOK".equals(state)) {
if (iState == 1) {
Log.i("OFFHOOK", "dont return!");
return;
}else{
startIncomingASAP();
setIstate(1);
Log.i("OFFHOOK", "return!"+iState);
}
}
}
}
Actually I want the receiver NOT TO START the startIncomingASAP() function on the latter OFFHOOK phone state by adding an Integer for indicating which OFFHOOK's turn it is. But it doesn't work properly: although the latter OFFHOOK-Log.i is shown in the LogCat normally (meaning that iState was set to 1 successfully), he ignores the state and starts the functions on the second OFFHOOK again ....
My DDMS view doesn't work properly and I'm kinda clueless now

someone has an idea??
greetz BossOss


