Prathima1981

i have to check for the caller information presence in my database for pocket pc wm 5.0 application.

when i get a call on my pocket pc how to check for the callers data in database can somone help with the code example plzzz

thanks




Re: Smart Devices VB and C# Projects data checking in database

Bruno Yu - MSFT

Move the thread from Visual Basic General in order to get satisfied answer.






Re: Smart Devices VB and C# Projects data checking in database

Zero Dai - MSFT

Hi Prathima,

In Windows Mobile 5.0, you can use managed class SystemState (State and Notification Broker).

I assume that you have installed Windows Mobile 5.0 SDK:

Add the reference to the following 3 assembly in your project:

  1. Microsoft.WindowsMobile
  2. Microsoft.WindowsMobile.PocketOutlook
  3. Microsoft.WindowsMobile.Status
Code Snippet

using Microsoft.WindowsMobile.Status;

using Microsoft.WindowsMobile.PocketOutlook;

SystemState state = new SystemState(SystemProperty.PhoneIncomingCall);

state.Changed += new ChangeEventHandler(state_Changed);

// When a call comes, the changed event handler will be called

void state_Changed(object sender, ChangeEventArgs args)
{
Contact contact = SystemState.PhoneIncomingCallerContact;

//Use Contact object to get the callers's information that stored in your phone contact list
}

If the information is stored in your own .sdf file, you can use SystemState.PhoneIncomingCallerNumber to get the phone number, and create a select query in your database.

Thanks,

Zero Dai - MSFT






Re: Smart Devices VB and C# Projects data checking in database

jaczura

Hi!

I managed to intercept phone call and retrieve phone number.

But I can retrieve phone number or being notified only when I click Ignore or accept on the standard Windows Phone form when Incomming call arrives.

I would like to make a query while ringing.

How to solve it to retrieve phone number while ringing

My VB.NET code:

Friend WithEvents IncomingCall As New SystemState(SystemProperty.PhoneIncomingCall)
Dim PhoneNumber As String

Private Sub CheckCallStatus(ByVal Sender As Object, ByVal Args As ChangeEventArgs) Handles IncomingCall.Changed
PhoneNumber = SystemState.GetValue(SystemProperty.PhoneIncomingCallerNumber)
Me.Text = PhoneNumber
End Sub


Thank you!




Re: Smart Devices VB and C# Projects data checking in database

??

Hi jaczura,

Could you please try to debug when CheckCallStatus comes to be called Try to see if SystemState.GetValue get called correctly. I may guess there exists another issue.

Regards.






Re: Smart Devices VB and C# Projects data checking in database

jaczura

Thank you!

Application.DoEvents() was the key for magic.