public AndroidTelephonyProbe() { _outgoingCallCallback = async(sender, outgoingNumber) => { _outgoingIncomingTime = DateTime.Now; await StoreDatumAsync(new TelephonyDatum(DateTimeOffset.UtcNow, TelephonyState.OutgoingCall, outgoingNumber, null)); }; _idleIncomingCallListener = new AndroidTelephonyIdleIncomingListener(); _idleIncomingCallListener.IncomingCall += async(o, incomingNumber) => { _outgoingIncomingTime = DateTime.Now; await StoreDatumAsync(new TelephonyDatum(DateTimeOffset.UtcNow, TelephonyState.IncomingCall, incomingNumber, null)); }; _idleIncomingCallListener.Idle += async(o, phoneNumber) => { // only calculate call duration if we have previously received an incoming or outgoing call event (android might report idle upon startup) double?callDurationSeconds = null; if (_outgoingIncomingTime != null) { callDurationSeconds = (DateTime.Now - _outgoingIncomingTime.Value).TotalSeconds; } await StoreDatumAsync(new TelephonyDatum(DateTimeOffset.UtcNow, TelephonyState.Idle, phoneNumber, callDurationSeconds)); }; }
public AndroidTelephonyProbe() { _outgoingCallCallback = (sender, outgoingNumber) => { _outgoingIncomingTime = DateTime.Now; StoreDatum(new TelephonyDatum(DateTimeOffset.UtcNow, TelephonyState.OutgoingCall, outgoingNumber, null)); }; _idleIncomingCallListener = new AndroidTelephonyIdleIncomingListener(); _idleIncomingCallListener.IncomingCall += (o, incomingNumber) => { _outgoingIncomingTime = DateTime.Now; StoreDatum(new TelephonyDatum(DateTimeOffset.UtcNow, TelephonyState.IncomingCall, incomingNumber, null)); }; _idleIncomingCallListener.Idle += (o, e) => { // only calculate call duration if we have previously received an incoming or outgoing call event (android might report idle upon startup) double? callDurationSeconds = null; if (_outgoingIncomingTime != null) callDurationSeconds = (DateTime.Now - _outgoingIncomingTime.GetValueOrDefault()).TotalSeconds; StoreDatum(new TelephonyDatum(DateTimeOffset.UtcNow, TelephonyState.Idle, null, callDurationSeconds)); }; }
public AndroidTelephonyProbe() { _outgoingCallCallback = (sender, outgoingNumber) => { StoreDatum(new TelephonyDatum(DateTimeOffset.UtcNow, TelephonyState.OutgoingCall, outgoingNumber)); }; _idleIncomingCallListener = new AndroidTelephonyIdleIncomingListener(); _idleIncomingCallListener.IncomingCall += (o, incomingNumber) => { StoreDatum(new TelephonyDatum(DateTimeOffset.UtcNow, TelephonyState.IncomingCall, incomingNumber)); }; _idleIncomingCallListener.Idle += (o, e) => { StoreDatum(new TelephonyDatum(DateTimeOffset.UtcNow, TelephonyState.Idle, null)); }; }
public AndroidTelephonyProbe() { _outgoingCallCallback = (sender, outgoingNumber) => { StoreDatum(new TelephonyDatum(DateTimeOffset.UtcNow, TelephonyState.OutgoingCall, outgoingNumber)); }; _idleIncomingCallListener = new AndroidTelephonyIdleIncomingListener(); _idleIncomingCallListener.IncomingCall += (o, incomingNumber) => { StoreDatum(new TelephonyDatum(DateTimeOffset.UtcNow, TelephonyState.IncomingCall, incomingNumber)); }; _idleIncomingCallListener.Idle += (o, e) => { StoreDatum(new TelephonyDatum(DateTimeOffset.UtcNow, TelephonyState.Idle, null)); }; }