How to handle calls in Windows Phone 8 application

Viewed 1061

My app uses a timer that vibrates the device. Now I want to stop this timer when the call is received, otherwise the device goes on vibrating during the call also, and start it back again when the call ends. I tried to handle the events Obscured and Unobscured

PhoneApplicationFrame rootFrame = App.Current.RootVisual as PhoneApplicationFrame;

if (rootFrame != null)
{
    rootFrame.Obscured += new EventHandler<ObscuredEventArgs>(rootFrame_Obscured);
    rootFrame.Unobscured += new EventHandler(rootFrame_Unobscured);
}

but this is not working. These events did not occur when the call was received. How should i handle this?

1 Answers
Related