当前位置: 首页>>代码示例>>Java>>正文


Java WifiP2pManager.WIFI_P2P_DISCOVERY_STOPPED属性代码示例

本文整理汇总了Java中android.net.wifi.p2p.WifiP2pManager.WIFI_P2P_DISCOVERY_STOPPED属性的典型用法代码示例。如果您正苦于以下问题:Java WifiP2pManager.WIFI_P2P_DISCOVERY_STOPPED属性的具体用法?Java WifiP2pManager.WIFI_P2P_DISCOVERY_STOPPED怎么用?Java WifiP2pManager.WIFI_P2P_DISCOVERY_STOPPED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.net.wifi.p2p.WifiP2pManager的用法示例。


在下文中一共展示了WifiP2pManager.WIFI_P2P_DISCOVERY_STOPPED属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onWifiP2pDiscoveryChanged

/**
 * Receive events noting when Android has started or stopped looking
 * for Wifi P2P peers.
 */
private void onWifiP2pDiscoveryChanged(Context context, Intent intent) {
  int discoveryStateCode = intent.getIntExtra(WifiP2pManager.EXTRA_DISCOVERY_STATE, -1);
  if (discoveryStateCode == WifiP2pManager.WIFI_P2P_DISCOVERY_STARTED) {
    log.debug( "Device is seeking Wifi Direct peers.");
      Log.d("peerDebug", "Device is seeking Wifi Direct peers.");
    setSeeking(true);
  } else if (discoveryStateCode == WifiP2pManager.WIFI_P2P_DISCOVERY_STOPPED) {
    log.debug( "Device is NOT seeking Wifi Direct peers.");
      Log.d("peerDebug", "Device is NOT seeking Wifi Direct peers.");
    setSeeking(false);
  } else {
    log.error( "Discovery changed event didn't have an EXTRA_DISCOVERY_STATE?!");
      Log.d("peerDebug", "Discovery changed event didn't have an EXTRA_DISCOVERY_STATE?!");
  }
}
 
开发者ID:casific,项目名称:murmur,代码行数:19,代码来源:WifiDirectSpeaker.java

示例2: onWifiP2pDiscoveryChanged

/**
 * Receive events noting when Android has started or stopped looking
 * for Wifi P2P peers.
 */
private void onWifiP2pDiscoveryChanged(Context context, Intent intent) {
  int discoveryStateCode = intent.getIntExtra(WifiP2pManager.EXTRA_DISCOVERY_STATE, -1);
  if (discoveryStateCode == WifiP2pManager.WIFI_P2P_DISCOVERY_STARTED) {
    Log.d(TAG, "Device is seeking Wifi Direct peers.");
    setSeeking(true);
  } else if (discoveryStateCode == WifiP2pManager.WIFI_P2P_DISCOVERY_STOPPED) {
    Log.d(TAG, "Device is NOT seeking Wifi Direct peers.");
    setSeeking(false);
  } else {
    Log.wtf(TAG, "Discovery changed event didn't have an EXTRA_DISCOVERY_STATE?!");
  }
}
 
开发者ID:casific,项目名称:murmur,代码行数:16,代码来源:WifiDirectSpeaker.java


注:本文中的android.net.wifi.p2p.WifiP2pManager.WIFI_P2P_DISCOVERY_STOPPED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。