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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -