Flash light on call and message

I am working on an application if user recieves call flash light should turn on and turn off once call answered.

Flash light should turn on for 5 seconds once a msg is recieved

Both from pre defined phone number.

Also a switch to turn on Torch one once

I used below code but it doesn't seem to work even after sms permission given.

Need guidance.

did you try something else, for example the text to speech component to speak a message?

probably the itoo extension can help?

however this will be a bit more advanced...


No i haven't, I need it to blink flash.
You see I made another app for another phone which send direct msg and direct call to my phone after clicking ths buttons with same name

So if I receive call or msg from that phone number
I need mine to flashblink

Then ket me suggest you to try something and experiment... is the issue that the event is not be triggered or is the flashlight not working in thise cases?