[英]windows mobile 6.5 .net CF - how to get notification that the internal phone turns on or off
我可以使用哪种API来获取有关手机状态变化的通知? 例如,我有我的应用程序,想知道用户关闭或通过无线管理器打电话?
问候
使用State和Notification Broker来监视PhoneRadioOff属性。 可以在此处找到设置代理的示例。
像这样:
using Microsoft.WindowsMobile.Status;
var phoneRadioOffState = new SystemState(SystemProperty.PhoneRadioOff);
phoneRadioOffState.Changed += (sender, e) =>
{
var off = Convert.ToBoolean(e.NewValue);
// Here you can do whatever you'd like when the phone is on or off.
};
请记住, phoneRadioOffState
必须在scope / alive中才能调用事件处理程序,因此将它作为方法局部变量通常不是一个好主意。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.