java - Flashlight app doesn't always stop when receiving calls -
i trying make flashlight turn off whenever call or sms message received. works in devices (i.e. huawei devices) flash light doesn't turn off when reject 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; } }
Comments
Post a Comment