蓝牙、wifi 和铃声模式的广播意图

发布于 2024-10-04 10:25:55 字数 87 浏览 4 评论 0原文

以下事件中广播的意图是什么,

  1. Wifi 状态更改、
  2. 蓝牙状态更改、
  3. 振铃模式更改

What are the intents that are broadcasted in the following events,

  1. Wifi state change
  2. Bluetooth state change
  3. Ringer mode change

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

∞觅青森が 2024-10-11 10:25:55

对于 Wifi 状态更改:

WifiManager.WIFI_STATE_CHANGED_ACTION ("android .net.wifi.WIFI_STATE_CHANGED”)

广播意图动作指示
Wi-Fi 已启用、禁用,
启用、禁用或未知。一
extra 将此状态作为 int 提供。
另一个额外提供了之前的
说明(如果有)。

WifiManager.NETWORK_STATE_CHANGED_ACTION(“android.net.wifi.STATE_CHANGE”)

广播意图动作指示
Wi-Fi 连接状态
已经改变了。另一项额外提供的是
NetworkInfo 形式的新状态
目的。如果新状态为 CONNECTED,
第二个额外的可能提供 BSSID
接入点的名称,作为字符串。

WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION(“android.net.wifi.supplicant.CONNECTION_CHANGE”)

广播意图动作指示
与请求者的连接
已经成立(现在是
可以执行 Wi-Fi 操作)
或与请求者的连接
已丢失。另一项额外提供的是
连接状态为布尔值,其中
true 表示已连接。

另请查看 ConnectivityManager.CONNECTIVITY_ACTION ("android.net.conn.CONNECTIVITY_CHANGE")

网络连接发生了变化
发生。连接已
成立或丧失。网络信息
对于受影响的网络作为
额外的;应该咨询一下
什么样的连接事件
发生了。

如果这是一个连接
故障转移的结果
断开网络,然后
FAILOVER_CONNECTION 布尔值额外的是
设置为 true。

对于连接丢失,如果
连接管理器正在尝试
连接(或已经连接)到
另一个网络,NetworkInfo 为
新网络也作为
额外的。这使得任何接收者
广播知道他们不应该
必须告诉用户没有数据
交通将成为可能。相反,
接收者应该期待另一个
即将播出,表明
故障转移尝试成功(所以
总体数据还是有的
连接),或者故障转移
尝试失败,意味着所有
连接已丢失。

对于断开连接事件,布尔值
额外的 EXTRA_NO_CONNECTIVITY 设置为
如果没有连接则为 true
根本没有网络。

对于蓝牙状态更改:

BluetoothAdapter.ACTION_STATE_CHANGED ("android.bluetooth .适配器.action.STATE_CHANGED”)

广播行动:状态
本地蓝牙适配器已
改变了。
例如蓝牙已开启
打开或关闭。

对于振铃模式更改:

AudioManager.RINGER_MODE_CHANGED_ACTION ("android.media.RINGER_MODE_CHANGED")

粘性广播意图操作
表示振铃模式有
改变了。包括新的铃声模式。

不是铃声模式更改,但这也可以很好地使用 AudioManager.VIBRATE_SETTING_CHANGED_ACTION ("android.media.VIBRATE_SETTING_CHANGED")

广播意图动作指示
振动设置已更改。
包括振动类型及其新的
设置。

(哦,没有代表,所以只有 2 个链接...:( )

For Wifi state changes:

WifiManager.WIFI_STATE_CHANGED_ACTION ("android.net.wifi.WIFI_STATE_CHANGED")

Broadcast intent action indicating
that Wi-Fi has been enabled, disabled,
enabling, disabling, or unknown. One
extra provides this state as an int.
Another extra provides the previous
state, if available.

WifiManager.NETWORK_STATE_CHANGED_ACTION ("android.net.wifi.STATE_CHANGE")

Broadcast intent action indicating
that the state of Wi-Fi connectivity
has changed. One extra provides the
new state in the form of a NetworkInfo
object. If the new state is CONNECTED,
a second extra may provide the BSSID
of the access point, as a String.

WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION ("android.net.wifi.supplicant.CONNECTION_CHANGE")

Broadcast intent action indicating
that a connection to the supplicant
has been established (and it is now
possible to perform Wi-Fi operations)
or the connection to the supplicant
has been lost. One extra provides the
connection state as a boolean, where
true means CONNECTED.

Also take a look at ConnectivityManager.CONNECTIVITY_ACTION ("android.net.conn.CONNECTIVITY_CHANGE")

A change in network connectivity has
occurred. A connection has either been
established or lost. The NetworkInfo
for the affected network is sent as an
extra; it should be consulted to see
what kind of connectivity event
occurred.

If this is a connection that was the
result of failing over from a
disconnected network, then the
FAILOVER_CONNECTION boolean extra is
set to true.

For a loss of connectivity, if the
connectivity manager is attempting to
connect (or has already connected) to
another network, the NetworkInfo for
the new network is also passed as an
extra. This lets any receivers of the
broadcast know that they should not
necessarily tell the user that no data
traffic will be possible. Instead, the
reciever should expect another
broadcast soon, indicating either that
the failover attempt succeeded (and so
there is still overall data
connectivity), or that the failover
attempt failed, meaning that all
connectivity has been lost.

For a disconnect event, the boolean
extra EXTRA_NO_CONNECTIVITY is set to
true if there are no connected
networks at all.

For Bluetooth state changes:

BluetoothAdapter.ACTION_STATE_CHANGED ("android.bluetooth.adapter.action.STATE_CHANGED")

Broadcast Action: The state of the
local Bluetooth adapter has been
changed.
For example, Bluetooth has been turned
on or off.

and for Ringer mode changes:

AudioManager.RINGER_MODE_CHANGED_ACTION ("android.media.RINGER_MODE_CHANGED")

Sticky broadcast intent action
indicating that the ringer mode has
changed. Includes the new ringer mode.

Not a ringer mode change, but this can be good to have also AudioManager.VIBRATE_SETTING_CHANGED_ACTION ("android.media.VIBRATE_SETTING_CHANGED")

Broadcast intent action indicating
that the vibrate setting has changed.
Includes the vibrate type and its new
setting.

(Ops, got no rep so only 2 links... :( )

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文