I am trying to make the flashlight turn off whenever a call or SMS message is received. It works perfectly but in some devices (i.e. HUAWEI devices) my flash light doesn't turn off when I reject the incoming call.
Relevant code:
else{ if(phoneManager.getCallState() == TelephonyManager.CALL_STATE_RINGING){ if(prefs.getBoolean("call", true)) { Log.e("call", "start -> type:" + prefs.getString("type", "")); String tp = prefs.getString("flash_type", ""); if(!tp.equals("")) flash.startCallFlashLight(getIndex(tp)); else flash.startCallFlashLight(1); lastState = TelephonyManager.CALL_STATE_RINGING; } } else if(lastState == TelephonyManager.CALL_STATE_RINGING && ( phoneManager.getCallState() == TelephonyManager.CALL_STATE_OFFHOOK || phoneManager.getCallState() == TelephonyManager.CALL_STATE_IDLE)) { Log.e("call", "stop"); flash.stopCallFlashLight(); lastState = -1; } }
xD, you tried connecting problematic devices to the developing computer?? are the states updated correctly?