[英]Xamarin:Different between ConnectivityManager.ConnectivityAction and BluetoothAdapter.ACTION_STATE_CHANGED
I wanted to know what is the different between ConnectivityAction and Action_State_Change. 我想知道ConnectivityAction和Action_State_Change之间有什么区别。
At the moment, I am having a broadcastReceiver which listen to ConnectivityAction to check the wifi enable/disable state. 目前,我有一个broadcastReceiver,它监听ConnectivityAction以检查wifi的启用/禁用状态。 In addition, I used ConnectivityAction to listen Bluetooth enable/disable state.
另外,我使用ConnectivityAction侦听蓝牙的启用/禁用状态。
In Action_State_Change, I can do the same to detect enable/disable the Bluetooth by checking the intent State_On. 在Action_State_Change中,我可以通过检查意图State_On来检测蓝牙的启用/禁用。
The difference I have between ConnectivityAction and Action_State_Change is: When I register ConnectivityAction in onStart and unregister it in onStop in my Activity, then when user select the enable/disable in setting screen, the receiver still receive the message. 我在ConnectivityAction和Action_State_Change之间的区别是:当我在Activity的onStart中注册并在onStop中取消注册ConnectivityAction时,然后当用户在设置屏幕中选择启用/禁用时,接收方仍会收到该消息。 On the other hand, if I used Action_State_Change, if the user select the enable/disable in setting screen, my broadcast receiver with Action_State_Change won't receive the message.
另一方面,如果我使用Action_State_Change,则如果用户在设置屏幕中选择启用/禁用,则带有Action_State_Change的广播接收器将不会收到该消息。
What is the different between the two Action Filter. 两种动作过滤器有什么区别。
CONNECTIVITY_ACTION - A change in network connectivity has occurred. CONNECTIVITY_ACTION- 网络连接已发生更改。
ACTION_STATE_CHANGE - Broadcast Action: The state of the local Bluetooth adapter has been changed. ACTION_STATE_CHANGE-广播操作:本地蓝牙适配器的状态已更改。
The first applies to any network change, the second specifically to the Bluetooth adapter 第一种适用于任何网络更改,第二种适用于蓝牙适配器
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.