Receiving phone call notification in .Net compact application

G

Guest

Hello Guys,
I am developing an application that scans Pocket PC files
but I want to pause scanning when phone call is coming and resume it
automatically once it's finished. I am just wandering how to get phone call
notification in my application ?

Could anybody help me please?

Thanks,
-Santosh
 
G

Guest

If your device is Windows Mobile 5, you can use SystemState class from
Microsoft.WindowsMobile assemblies.
 
G

Guest

Thanks Alex. I just developed an application using 'SystemState' class and
able to get notification for incoming call but how to get notification when
call finishes?

Could you please help me out?

Thanks,
-Santosh
 
J

jonfroehlich

Santosh,

You could subscribe to either PhoneCallTalking or PhoneActiveCallCount.
When the state of a phone call changes, e.g. a user starts talking,
puts a call on hold, or hangs up, an event will be fired. For example,

SystemState statePhoneCall = new
SystemState(SystemProperty.PhoneCallTalking);
statePhoneCall.Changed += new
ChangeEventHandler(OnStatePhoneCallChanged);

private void OnStatePhoneCallChanged(object sender, ChangeEventArgs
args)
{
//we know we can cast args.NewValue to a bool here because
//SystemState.PhoneCallTalking returns a bool
bool bTalking = (bool)args.NewValue;
Debug.WriteLine((bTalking ? "Talking" : "NotTalking"));
}

Hope this helps,

Jon
 
G

Guest

Thanks Alex and Jon.

Cheers,
-Santosh

jonfroehlich said:
Santosh,

You could subscribe to either PhoneCallTalking or PhoneActiveCallCount.
When the state of a phone call changes, e.g. a user starts talking,
puts a call on hold, or hangs up, an event will be fired. For example,

SystemState statePhoneCall = new
SystemState(SystemProperty.PhoneCallTalking);
statePhoneCall.Changed += new
ChangeEventHandler(OnStatePhoneCallChanged);

private void OnStatePhoneCallChanged(object sender, ChangeEventArgs
args)
{
//we know we can cast args.NewValue to a bool here because
//SystemState.PhoneCallTalking returns a bool
bool bTalking = (bool)args.NewValue;
Debug.WriteLine((bTalking ? "Talking" : "NotTalking"));
}

Hope this helps,

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top