简体   繁体   English

Xamarin:ConnectivityManager.ConnectivityAction和BluetoothAdapter.ACTION_STATE_CHANGED之间不同

[英]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.

相关问题 registerReceiver BluetoothAdapter.ACTION_STATE_CHANGED不起作用 - registerReceiver BluetoothAdapter.ACTION_STATE_CHANGED not working android:ConnectivityManager.CONNECTIVITY_ACTION,当网络连接状态未更改时发送广播 - android: ConnectivityManager.CONNECTIVITY_ACTION, send broadcast when the net connected state has not changed BluetoothAdapter.STATE_OFF / DISCONNECTED之间的区别 - Difference between BluetoothAdapter.STATE_OFF/DISCONNECTED sendBroadcast ConnectivityManager.CONNECTIVITY_ACTION - sendBroadcast ConnectivityManager.CONNECTIVITY_ACTION ConnectivityManager.CONNECTIVITY_ACTION 已弃用 - ConnectivityManager.CONNECTIVITY_ACTION deprecated 检测对 BluetoothAdapter 所做的状态更改? - Detecting state changes made to the BluetoothAdapter? 使用 Xamarin.android 中的 BluetoothAdapter 执行蓝牙扫描 - Perform a bluetooth scan with BluetoothAdapter in Xamarin.android 如何模拟BluetoothAdapter.ACTION_REQUEST_ENABLE - How to Mock BluetoothAdapter.ACTION_REQUEST_ENABLE CONNECTION_STATE_CHANGED和STATE_CHANGED之间的区别 - Difference between CONNECTION_STATE_CHANGED and STATE_CHANGED Android中ConnectivityManager的网络状态查找问题 - Network State Finding Issue with ConnectivityManager in android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM