none
可以知道來電情況嗎? RRS feed

  • 問題

  • 請教大家
    如果有人現在打手機給我
    我可以寫一個程式得知嗎?
    或者是
    如何得知通訊記錄?
    請大家給各方向
    Thanks

     
    2010年2月23日 下午 09:54

解答

  • How to: Monitor calls on Windows Mobile using C#

    Someone just sent me a mail and asked if we had any C# samples / source code for monitoring status of incoming and outgoing calls. It all really depends on what you want to do with these calls, are you just trying to get the status? or trying to capture the audio? they're two very different scenarios.

    here's a list of System Properties that you can return 

    using Microsoft.WindowsMobile.Status 組件.

     

     I guess the segment that you're most interested in is this:

    Phone1xRttCoverage
    Gets a value indicating whether the phone currently has 1xRTT coverage.

    PhoneActiveCallCount
    Gets the number of active phone calls.

    PhoneActiveDataCall
    Gets a value indicating whether the phone has an active cellular data connection.

    PhoneBlockedSim
    Gets a value indicating whether the Subscriber Identity Module (SIM) is blocked.

    PhoneCallBarring
    Gets a value indicating whether the call barring feature is enabled.

    PhoneCallCalling
    Gets a value indicating whether the phone is currently attempting to connect an outgoing call.

    PhoneCallForwardingOnLine1
    Gets a value indicating whether call forwarding is enabled on line 1.

    PhoneCallForwardingOnLine2
    Gets a value indicating whether call forwarding is currently active on line 2.

    PhoneCallOnHold
    Gets a value indicating whether a phone call is currently on hold.

    PhoneCallTalking
    Gets a value indicating whether there is currently a phone call in the talking state.

    PhoneCellBroadcast
    Gets the cell broadcast message

    PhoneConferenceCall
    Gets a value indicating whether a conference call is currently in progress.

    PhoneGprsCoverage
    Gets a value indicating whether the phone currently has GPRS coverage.

    PhoneHomeService
    Gets a value indicating whether the phone is currently registered on its home network.

    PhoneIncomingCall
    Gets a value indicating whether there is an incoming (ringing) call.

    PhoneIncomingCallerContact
    Gets the Contact that matches the Caller ID.

    PhoneIncomingCallerContactPropertyID
    Gets the CEPROPID of the property that matches the Caller ID, for example, PIMPR_HOME_TELEPHONE_NUMBER.

    PhoneIncomingCallerContactPropertyName
    Gets the name of the property that matches the Caller ID, e.g. "h" for "Home Telephone".

    PhoneIncomingCallerName
    Gets the name of the person who is currently placing the incoming call.

    PhoneIncomingCallerNumber
    Gets the incoming call's phone number (Caller ID).

    PhoneInvalidSim
    Gets a value indicating whether the Subscriber Identity Module (SIM) is invalid.

    PhoneLastIncomingCallerContact
    Gets the Contact that matches the last Caller ID.

    PhoneLastIncomingCallerContactPropertyID
    Gets the CEPROPID of the property that matches the last Caller ID, for example, PIMPR_HOME_TELEPHONE_NUMBER.

    PhoneLastIncomingCallerContactPropertyName
    Gets the name of the property that matches the last Caller ID, e.g. "h" for "Home Telephone".

    PhoneLastIncomingCallerName
    Gets the name of the last caller to place an incoming call.

    PhoneLastIncomingCallerNumber
    Gets the last incoming call's phone number (Caller ID).

    PhoneLine1Selected
    Gets a value indicating whether line 1 is selected.

    PhoneLine2Selected
    Gets a value indicating whether line 2 is selected.

    PhoneMissedCall
    Gets a value indicating whether there was a new missed call.

    PhoneMissedCalls
    Gets the number of missed phone calls.

    PhoneMultiLine
    Gets a value indicating whether the phone supports multiple lines.

    PhoneNoService
    Gets a value indicating whether the phone is not currently connected to a network.

    PhoneNoSim
    Gets a value indicating whether the Subscriber Identity Module (SIM) is installed in the mobile device.

    PhoneOperatorName
    Gets the name of the mobile operator (i.e., the mobile phone company, or carrier).

    PhoneProfile
    Gets the non-localized name of the current sound profile. For example, "Normal", "Silent", "Car", "Headset", "Loud", "Meeting", or "Speakerphone". (Smartphone only)

    PhoneProfileName
    Gets the localized name of the current sound profile. (Smartphone only)

    PhoneRadioOff
    Gets a value indicating whether the phone's radio is turned off.

    PhoneRadioPresent
    Gets a value indicating whether the mobile device has a phone.

    PhoneRingerOff
    Gets a value indicating whether the phone's ringer is off (i.e., if it rings and/or vibrates).

    PhoneRoaming
    Gets a value indicating whether the phone is currently in roaming mode.

    PhoneSearchingForService
    Gets a value indicating whether the phone is currently searching for service on a network.

    PhoneSignalStrength
    Get the phone signal strength, expressed as a percentage of full strength.

    PhoneSimFull
    Gets a value indicating whether the Subscriber Identity Module (SIM) memory is full.

    PhoneTalkingCallerContact
    Gets the contact who is on the active phone call.

    PhoneTalkingCallerContactPropertyID
    Gets the CEPROPID of the property of the contact who is on the active phone call, for example, PIMPR_HOME_TELEPHONE_NUMBER.

    PhoneTalkingCallerContactPropertyName
    Gets the name of the property of the contact who is on the active phone call, e.g. "h" for "Home Telephone".

    PhoneTalkingCallerName
    Gets the name of the person you are talking to on the phone. This value is not set when you are talking on a conference call.

    PhoneTalkingCallerNumber
    Gets the currently connected caller's phone number.

    In order to return the status of these properties, you can use this simple code (as an example):

    InitializeComponent();
    SystemState _PhoneRoaming = new SystemState(
                                SystemProperty.PhoneRoaming);
    
    
    _PhoneRoaming.Change += new ChangeEventHandler(
                            _PhoneRoaming_Changed);
    
    
    void _PhoneRoaming_Changed(object sender, ChangeEventArgs args)
    {
       throw new Exception("The method or operation is not implemented.");
    }
    
    void _PhoneRoaming_Changed(object sender, ChangeEventArgs args)
    {
       if (SystemProperty.PhoneRoaming == false)
       {
          // Perform data network access
       }
    }
    
    

    How do you debug applications that uses the phone network under an emulator?

    There's a tool that ships with the SDK called FakeRIL or (Fake Radio Interface Layer) to simulate SMS and phone calls without actually having a cell network. Handy when using emulators for development. Barry Bond who used to work for the Mobile Team was the developer for the Windows Mobile emulators and he made a few posts and presented sessions on how you can use FakeRIL, here and here. Watch out for the "new version" when the new SDK is released, it has a lot more features than the old FakeRIL. When? Soon :)

    Jim Wilson has also written two articles on programming the State and Notification Broker. Here's a BIG list of sample code for programming on Windows Mobile 5.0

    Hope that helps.


    Cmf.Net (C) 2010
    2010年2月24日 上午 12:24

所有回覆

  • How to: Monitor calls on Windows Mobile using C#

    Someone just sent me a mail and asked if we had any C# samples / source code for monitoring status of incoming and outgoing calls. It all really depends on what you want to do with these calls, are you just trying to get the status? or trying to capture the audio? they're two very different scenarios.

    here's a list of System Properties that you can return 

    using Microsoft.WindowsMobile.Status 組件.

     

     I guess the segment that you're most interested in is this:

    Phone1xRttCoverage
    Gets a value indicating whether the phone currently has 1xRTT coverage.

    PhoneActiveCallCount
    Gets the number of active phone calls.

    PhoneActiveDataCall
    Gets a value indicating whether the phone has an active cellular data connection.

    PhoneBlockedSim
    Gets a value indicating whether the Subscriber Identity Module (SIM) is blocked.

    PhoneCallBarring
    Gets a value indicating whether the call barring feature is enabled.

    PhoneCallCalling
    Gets a value indicating whether the phone is currently attempting to connect an outgoing call.

    PhoneCallForwardingOnLine1
    Gets a value indicating whether call forwarding is enabled on line 1.

    PhoneCallForwardingOnLine2
    Gets a value indicating whether call forwarding is currently active on line 2.

    PhoneCallOnHold
    Gets a value indicating whether a phone call is currently on hold.

    PhoneCallTalking
    Gets a value indicating whether there is currently a phone call in the talking state.

    PhoneCellBroadcast
    Gets the cell broadcast message

    PhoneConferenceCall
    Gets a value indicating whether a conference call is currently in progress.

    PhoneGprsCoverage
    Gets a value indicating whether the phone currently has GPRS coverage.

    PhoneHomeService
    Gets a value indicating whether the phone is currently registered on its home network.

    PhoneIncomingCall
    Gets a value indicating whether there is an incoming (ringing) call.

    PhoneIncomingCallerContact
    Gets the Contact that matches the Caller ID.

    PhoneIncomingCallerContactPropertyID
    Gets the CEPROPID of the property that matches the Caller ID, for example, PIMPR_HOME_TELEPHONE_NUMBER.

    PhoneIncomingCallerContactPropertyName
    Gets the name of the property that matches the Caller ID, e.g. "h" for "Home Telephone".

    PhoneIncomingCallerName
    Gets the name of the person who is currently placing the incoming call.

    PhoneIncomingCallerNumber
    Gets the incoming call's phone number (Caller ID).

    PhoneInvalidSim
    Gets a value indicating whether the Subscriber Identity Module (SIM) is invalid.

    PhoneLastIncomingCallerContact
    Gets the Contact that matches the last Caller ID.

    PhoneLastIncomingCallerContactPropertyID
    Gets the CEPROPID of the property that matches the last Caller ID, for example, PIMPR_HOME_TELEPHONE_NUMBER.

    PhoneLastIncomingCallerContactPropertyName
    Gets the name of the property that matches the last Caller ID, e.g. "h" for "Home Telephone".

    PhoneLastIncomingCallerName
    Gets the name of the last caller to place an incoming call.

    PhoneLastIncomingCallerNumber
    Gets the last incoming call's phone number (Caller ID).

    PhoneLine1Selected
    Gets a value indicating whether line 1 is selected.

    PhoneLine2Selected
    Gets a value indicating whether line 2 is selected.

    PhoneMissedCall
    Gets a value indicating whether there was a new missed call.

    PhoneMissedCalls
    Gets the number of missed phone calls.

    PhoneMultiLine
    Gets a value indicating whether the phone supports multiple lines.

    PhoneNoService
    Gets a value indicating whether the phone is not currently connected to a network.

    PhoneNoSim
    Gets a value indicating whether the Subscriber Identity Module (SIM) is installed in the mobile device.

    PhoneOperatorName
    Gets the name of the mobile operator (i.e., the mobile phone company, or carrier).

    PhoneProfile
    Gets the non-localized name of the current sound profile. For example, "Normal", "Silent", "Car", "Headset", "Loud", "Meeting", or "Speakerphone". (Smartphone only)

    PhoneProfileName
    Gets the localized name of the current sound profile. (Smartphone only)

    PhoneRadioOff
    Gets a value indicating whether the phone's radio is turned off.

    PhoneRadioPresent
    Gets a value indicating whether the mobile device has a phone.

    PhoneRingerOff
    Gets a value indicating whether the phone's ringer is off (i.e., if it rings and/or vibrates).

    PhoneRoaming
    Gets a value indicating whether the phone is currently in roaming mode.

    PhoneSearchingForService
    Gets a value indicating whether the phone is currently searching for service on a network.

    PhoneSignalStrength
    Get the phone signal strength, expressed as a percentage of full strength.

    PhoneSimFull
    Gets a value indicating whether the Subscriber Identity Module (SIM) memory is full.

    PhoneTalkingCallerContact
    Gets the contact who is on the active phone call.

    PhoneTalkingCallerContactPropertyID
    Gets the CEPROPID of the property of the contact who is on the active phone call, for example, PIMPR_HOME_TELEPHONE_NUMBER.

    PhoneTalkingCallerContactPropertyName
    Gets the name of the property of the contact who is on the active phone call, e.g. "h" for "Home Telephone".

    PhoneTalkingCallerName
    Gets the name of the person you are talking to on the phone. This value is not set when you are talking on a conference call.

    PhoneTalkingCallerNumber
    Gets the currently connected caller's phone number.

    In order to return the status of these properties, you can use this simple code (as an example):

    InitializeComponent();
    SystemState _PhoneRoaming = new SystemState(
                                SystemProperty.PhoneRoaming);
    
    
    _PhoneRoaming.Change += new ChangeEventHandler(
                            _PhoneRoaming_Changed);
    
    
    void _PhoneRoaming_Changed(object sender, ChangeEventArgs args)
    {
       throw new Exception("The method or operation is not implemented.");
    }
    
    void _PhoneRoaming_Changed(object sender, ChangeEventArgs args)
    {
       if (SystemProperty.PhoneRoaming == false)
       {
          // Perform data network access
       }
    }
    
    

    How do you debug applications that uses the phone network under an emulator?

    There's a tool that ships with the SDK called FakeRIL or (Fake Radio Interface Layer) to simulate SMS and phone calls without actually having a cell network. Handy when using emulators for development. Barry Bond who used to work for the Mobile Team was the developer for the Windows Mobile emulators and he made a few posts and presented sessions on how you can use FakeRIL, here and here. Watch out for the "new version" when the new SDK is released, it has a lot more features than the old FakeRIL. When? Soon :)

    Jim Wilson has also written two articles on programming the State and Notification Broker. Here's a BIG list of sample code for programming on Windows Mobile 5.0

    Hope that helps.


    Cmf.Net (C) 2010
    2010年2月24日 上午 12:24
  • 有關抓取通訊記錄部分,之前有討論過了,可以搜尋論壇或是參考blog這篇

    http://www.dotblogs.com.tw/bauann/archive/2009/03/30/7766.aspx
    請注意討論區相關規則,良好的討論環境需要大家共同努力、遵守
    2010年2月24日 上午 04:58
    版主
  • Thanks alot
    2010年3月15日 下午 12:54
  • 下面程式碼是我最後測試OK

    謝謝大家的指導

    ------------------------------------------------------------------------------

    Public Class Form1
        '使用SystemState的宣告
        Dim s As SystemState = New SystemState(SystemProperty.PhoneLastIncomingCallerNumber)
        Private Sub SystemState_PhoneMissedCalls()
            Label1.Text = s.CurrentValue.ToString   '顯示值
        End Sub
        Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
            AddHandler s.Changed, AddressOf SystemState_PhoneMissedCalls    '改變時使用
        End Sub
    End Class

     

    2010年3月30日 上午 02:20