text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.gbif.crawler.protocol.tapir;

import org.gbif.crawler.ResponseHandler;
import org.gbif.crawler.protocol.BaseParameterizedResponseHandlerTest;

import java.util.stream.Stream;

import org.apache.http.HttpResponse;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

public class ParameterizedTapirResponseHandlerTest extends BaseParameterizedResponseHandlerTest {

  @ParameterizedTest(name = "{index}: {0}")
  @MethodSource("data")
  public void testHandlingResponsesTapir(
      String comment,
      String fileName,
      Integer recordCount,
      Long contentHash,
      Boolean endOfRecords,
      boolean exceptionExpected) throws Exception {
    super.testHandlingResponses(fileName, recordCount, contentHash, endOfRecords, exceptionExpected);
  }

  @Override
  protected ResponseHandler<HttpResponse, ?> getResponseHandler() {
    return new TapirResponseHandler();
  }

  public static Stream<Arguments> data() throws Exception {
    return getTestData("org/gbif/crawler/protocol/tapir/responses.json");
  }
}


text:
package com.twp.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.twp.entity.SysUserEntity;
import com.twp.utils.ShiroUtils;

/**
 * Controller公共组件
 *
 */
public abstract class AbstractController {
	protected Logger logger = LoggerFactory.getLogger(getClass());

	protected SysUserEntity getUser() {
		return ShiroUtils.getUserEntity();
	}

	protected Long getUserId() {
		return getUser().getUserId();
	}
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:jaxrs="http://cxf.apache.org/jaxrs"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
					http://www.springframework.org/schema/beans/spring-beans.xsd
					http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-2.5.xsd
					http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
					http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
	<!-- 注解配置,如果有新的注解在后逗号分隔,这一段务必保留 -->
	<context:component-scan base-package="com.founder.fix" />

	<!-- 读取数据库配置所在 -->
	<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
	   	<property name="location" value="classpath:/jdbc.properties"/>
	</bean>
	<!-- 数据源配置,该数据源可以是spring连接池也可以是来自服务器连接池 -->
	<bean id="fix_biz_base_dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" >
	    <property name="driverClassName" value="${idbase.driverClassName}" />
	    <property name="url" value="${idbase.url}" />
	    <property name="username" value="${idbase.username}" />
	    <property name="password" value="${idbase.password}" />
	</bean>
	<!-- 平台本身的连接配置,DB_FIX_BIZ_BASE是连接名称,改名称与fixflowconfig.xml里的可用连接一一对应-->
	<bean id="DB_FIX_BIZ_BASE" scope="prototype" class="com.founder.fix.fixflow.shell.DBConnFactory">
	  <property name="dataSource">
	    <ref bean="fix_biz_base_dataSource"/>
	  </property>
	</bean>

	<!-- 平台本身的连接配置,DB_FIX_BIZ_BASE是连接名称,改名称与fixflowconfig.xml里的可用连接一一对应-->
	<bean id="mysql" scope="prototype" class="com.founder.fix.fixflow.shell.DBConnFactory">
	  <property name="dataSource">
	    <ref bean="fix_biz_base_dataSource"/>
	  </property>
	</bean>

		<!-- 平台本身的连接配置,DB_FIX_BIZ_BASE是连接名称,改名称与fixflowconfig.xml里的可用连接一一对应-->
	<bean id="sqlserver" scope="prototype" class="com.founder.fix.fixflow.shell.DBConnFactory">
	  <property name="dataSource">
	    <ref bean="fix_biz_base_dataSource"/>
	  </property>
	</bean>

</beans>


text:
package com.lachesis.mnis.core.patientManage.reposity;

import java.util.List;
import java.util.Map;

import com.lachesis.mnis.core.patientManage.entity.PatCureLocalInfo;
import com.lachesis.mnis.core.patientManage.entity.PatLeaveGoout;
import com.lachesis.mnis.core.patientManage.entity.PatNdaManageInfo;
import com.lachesis.mnis.core.patientManage.entity.PatOperationInfo;
import com.lachesis.mnis.core.patientManage.entity.PatOperationStatus;
import com.lachesis.mnis.core.patientManage.entity.PatOrderConfiguration;

public interface PatientManageRepository {

	int savePatOperationInfo(PatOperationInfo patOperationInfo);

	int savePatOperationStatus(PatOperationStatus patOperationStatus);

	int savePatOrderConfiguration(PatOrderConfiguration patOrderConfiguration);

	List<PatOrderConfiguration> queryAllPatOrderConfiguration();

	PatOperationInfo getPatOperationInfoByPatId(Map<String, Object> conditionMap);

	PatOperationStatus getRecentlyPatOperationByPatId(String patId);

	List<PatOperationInfo> queryAllPatOperationInfo();

	List<PatOperationInfo> queryByStatusOrDate(Map<String, Object> conditionMap);

	int savePatCureLocalInfo(PatCureLocalInfo patCureLocalInfo);

	int savePatLeaveGoout(PatLeaveGoout patLeaveGoout);

	List<PatCureLocalInfo> queryAllOutPatientByDateAndStatus(Map<String, String> conditionMap);

	PatNdaManageInfo queryNdaManageInfo(Map<String, String> conditionMap);

}


text:
/**
 * 作者:黄鑫
 * 日期:2013-03-07
 * 描述:用户Store
 */
define(["dojo/data/ItemFileWriteStore",
	"dojo/_base/declare",
	"dojo/_base/connect",
	"dojo/_base/lang",
    "capec/utils/ajax",
    "capec/data/QueryReadStore"], function($ItemFileWriteStore,$declare,$connect,$lang,$ajax,$QueryReadStore){
	return $declare(null,{
		vpath: "",
		_grid: null,
		_store: null,
		_dialog: null,
		bindGrid: function($grid){
			this._grid = $grid;
			this.loadData();
		},
		bindDialog: function($dialog){
			this._dialog = $dialog;
		},
		constructor: function(){
			this.inherited(arguments);
			if(arguments[0].vpath) this.vpath = arguments[0].vpath;
		},
		loadData: function(){
			var __query = new $QueryReadStore({
				url: this.vpath +"testData/role_SUPERS.json",
				requestMethod: "post"
			});
			this._grid.setStore(__query);
			__query.grid = this._grid._grid;

			console.log(__query);
		},
		searchData: function($params){
			this._grid.setQuery($params);
		},
		_onDataLoaded: function($data){
			if(this._store != null){
				this._store.close();
				this._store = null;
			}
			this._store = new $ItemFileWriteStore({ data: $data });
			this._grid.setStore(this._store);
		},
		_newItem: function($data){
			this._dialog.hide();
			this._grid.refresh();
		},
		newItem: function($item){
			$ajax({
				async : true,
				content: dojo.toJson({ data: $item }),
				url : this.vpath +"testData/role_add.json",
				callback: $lang.hitch(this, "_newItem")
			});
		},
		_setAllValue: function($item){
			var __item = arguments[1];
			if(__item == null) return;

			var __newValue = arguments[0][0].responseInfo;

			for(var __prop_3 in __newValue){
				if(__prop_3 != "id") {
					this._store.setValue(__item, __prop_3, __newValue[__prop_3]);
				}
			}
			this._store.save();
		},
		_setItem: function($data){
			console.log("更新角色");
			this._dialog.hide();
			this._grid.refresh();
		},
		setItem: function($item){
			$ajax({
				async : true,
				content: dojo.toJson({ data: $item }),
				url : this.vpath +"testData/role_edit.json",
				callback: $lang.hitch(this, "_setItem")
			});
		},
		_removeItem: function($data){
			console.log("删除角色");
			this._grid.refresh();
		},
		removeItem: function(){
			var __ids = this._grid.getSelectItemIds();
			$ajax({
				async : true,
				content: { ids: __ids },
				url : this.vpath +"testData/user_del.json",
				callback: $lang.hitch(this, "_removeItem")
			});
		}
	})
});


text:
/* Background color for the top bar */
/* Height and margin */
/* Control Input height for top bar */
/* Controlling the styles for the title in the top bar */
/* Style the top bar dropdown elements */
/* Set the link colors and styles for top-level nav */
/* Top menu icon styles */
/* Divider Styles */
/* Magelan */
/* Breadcrumbs */
@import url(http://fonts.googleapis.com/css?family=Cabin:400,400italic,500,500italic,600,600italic,700,700italic);
@import url(http://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700);
h1 {
  font-size: 4rem;
  color: #333;
}

h2 {
  font-size: 3rem;
  color: #444;
}

.navbar {
  min-height: 130px;
  margin-bottom: 0;
  border-radius: 0;
}

.navbar-collapse {
  box-shadow: none;
}

.navbar-brand {
  height: 130px;
  text-align: center;
}
@media (max-width: 992px) {
  .navbar-brand {
    width: 100%;
  }
}
.navbar-brand .logo span {
  color: #FFF;
  margin-top: 0px;
  font-size: 32px;
  display: block;
}

.navbar-form {
  text-align: right;
  margin: 20px -15px;
}

.navbar-toggle {
  position: absolute;
  right: 0;
}

.navbar-default {
  background: #e2353b;
  border: 0;
  border-bottom: 4px #fc5050 solid;
}

.navbar-default .navbar-nav > li > a,
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
  color: #FFF;
  font-size: 1.7rem;
  line-height: 20px;
}

.navbar-default .navbar-toggle {
  border-color: #fafafa;
  border-radius: 2px;
}

.navbar-default .navbar-toggle .icon-bar {
  background-color: #FFF;
}

.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
  background-color: #fc5050;
}

.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
  color: #FFF;
  background-color: transparent;
}

.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
  border: none;
}

.navbar-collapse li {
  text-align: center;
}

.breadcrumb {
  padding: 0;
  background-color: transparent;
  margin-bottom: 0;
  border-radius: 0;
}

body {
  position: relative;
  background: white;
  -webkit-font-smoothing: antialiased;
  font-family: "Cabin";
}

a {
  color: #e2353b;
}

h1, h2 {
  margin-bottom: 30px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Roboto Slab', serif;
}

header {
  font-family: 'Roboto Slab', serif;
}
header nav.externals {
  height: 30px;
  background: #EEEEEE;
}
header nav.externals a {
  line-height: 28px;
  color: #666;
  font-size: 13px;
  padding: 0 15px;
}

nav.menu .logo {
  width: 250px;
}
nav.menu .logo img, nav.menu .logo .title {
  float: left;
}
nav.menu .logo .title {
  margin-left: 15px;
}
nav.menu .logo span {
  display: block;
  font-size: 24px;
}
nav.menu .logo span em {
  font-style: normal;
  color: #ffd503;
}
nav.menu .logo span:first-of-type {
  font-size: 28px;
  margin-bottom: 10px;
  margin-top: 17px;
}
nav.menu .logo span:last-of-type {
  margin-top: 7px;
  font-size: 12.5px;
}
@media (min-width: 768px) {
  nav.menu .menu-items {
    max-width: 100%;
  }
  nav.menu .menu-items > li {
    float: right;
  }
}
@media (min-width: 992px) {
  nav.menu .menu-items {
    max-width: 670px;
  }
}
@media (min-width: 1200px) {
  nav.menu .menu-items {
    max-width: 857px;
  }
}

nav.breadcrumbs {
  height: 35px;
  line-height: 35px;
  background: #444;
  padding-left: 20px;
}
nav.breadcrumbs, nav.breadcrumbs a {
  color: #ededed;
}

section#main {
  background: #fafafa;
  min-height: 800px;
  padding: 20px 50px;
}
section#main .search-results h4 {
  text-align: center;
}
section#main .ccm-page-list .page {
  margin-bottom: 30px;
}
section#main .rss .item {
  margin: 20px 0;
}
section#main .rss .item .date {
  color: grey;
  font-size: 13px;
  width: 35px;
}
section#main .rss .item .summary {
  margin-top: 10px;
  padding-left: 35px;
}
section#main .aside-menu h6 {
  font-size: 18px;
  border-bottom: 2px solid #DDD;
  padding-bottom: 7px;
  color: #888;
}
section#main .aside-menu.affix {
  top: 50px !important;
  left: auto !important;
}
section#main .aside-menu.affix ul {
  max-width: 200px;
}
section#main .aside-menu li {
  border-left: 2px solid transparent;
}
section#main .aside-menu li.active {
  border-left-color: #AAA;
}
section#main .aside-menu li a {
  color: #AAA;
  font-size: 1.5rem;
  padding: 6px 15px;
}

footer .upper {
  min-height: 250px;
  background: #EEEEEE;
  padding: 20px;
  color: #888;
}
footer .lower {
  height: 100px;
  background: #444;
  color: white;
  padding: 20px;
}

.ccm-ui select, .ccm-ui input {
  line-height: normal;
  height: 28px;
}


text:
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>interior_rings (const version)</title>
<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../../../../index.html" title="Chapter 1. Geometry">
<link rel="up" href="../interior_rings.html" title="interior_rings">
<link rel="prev" href="interior_rings_1.html" title="interior_rings">
<link rel="next" href="../../adapted.html" title="Adapted models">

Home
Libraries
People
FAQ
More

interior_rings
          (const version)

Function to get the interior rings of a polygon (const version)

            Synopsis

template<typename Polygon>
interior_return_type<Polygon const>::type interior_rings(Polygon const & polygon)

            Parameters

<colgroup>
<col>
<col>
<col>
<col>
</colgroup>

                      Type

                      Concept

                      Name

                      Description

                      Polygon const &

                      polygon type

                      polygon

                      the polygon to get the interior rings from

            Returns

            the interior rings (possibly a const reference)

            Header

            Either

            #include <boost/geometry/geometry.hpp>

            Or

            #include <boost/geometry/core/interior_rings.hpp>

Copyright © 2009-2013 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam Wulkiewicz

        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)


text:
UPDATE jiveVersion SET majorVersion=2, minorVersion=5;

# jivePrivacyList: Create new table
CREATE TABLE jivePrivacyList (
  username              VARCHAR(32)     NOT NULL,
  name                  VARCHAR(100)    NOT NULL,
  isDefault             TINYINT         NOT NULL,
  list                  TEXT            NOT NULL,
  PRIMARY KEY (username, name),
  INDEX jivePList_default_idx (username, isDefault)
);


text:
function MailCtrl() {
  var vm = this;
  vm.showTooltip = false
  vm.list = [
    {
      title: 'Gautier is a wonderful guy',
      sender: 'Laure',
      body: 'I loooove Gautier !'
    },
    {
      title: 'Arthur + Bastien = <3 ?',
      sender: 'Gautier',
      body: 'I was wondering if....'
    }
  ]

  vm.add = function() {
    this.list.push({
      title: 'I love you bro !',
      sender: 'Bastien',
      body: 'I need to tell you something Arthur...'
    })
  }
}

angular.module('sangu').controller('MailCtrl', MailCtrl);


text:
class AddUserIdToEpisode < ActiveRecord::Migration[4.2]
  def change
    add_column :episodes, :user_id, :integer
    add_index :episodes, :user_id
  end
end


text:
package org.cloudbus.cloudsim.container.containerVmProvisioners;

import org.cloudbus.cloudsim.container.core.ContainerVm;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by sareh on 10/07/15.
 */
public class ContainerVmRamProvisionerSimple extends ContainerVmRamProvisioner {

    /**
     * The RAM table.
     */
    private Map<String, Float> containerVmRamTable;

    /**
     * @param availableRam the available ram
     */
    public ContainerVmRamProvisionerSimple(int availableRam) {
        super(availableRam);
        setContainerVmRamTable(new HashMap<String, Float>());
    }

    @Override
    public boolean allocateRamForContainerVm(ContainerVm containerVm, float ram) {
        float maxRam = containerVm.getRam();

        if (ram >= maxRam) {
            ram = maxRam;
        }

        deallocateRamForContainerVm(containerVm);

        if (getAvailableRam() >= ram) {
            setAvailableRam(getAvailableRam() - ram);
            getContainerVmRamTable().put(containerVm.getUid(), ram);
            containerVm.setCurrentAllocatedRam(getAllocatedRamForContainerVm(containerVm));
            return true;
        }

        containerVm.setCurrentAllocatedRam(getAllocatedRamForContainerVm(containerVm));

        return false;
    }

    @Override
    public float getAllocatedRamForContainerVm(ContainerVm containerVm) {
        if (getContainerVmRamTable().containsKey(containerVm.getUid())) {
            return getContainerVmRamTable().get(containerVm.getUid());
        }
        return 0;
    }

    @Override
    public void deallocateRamForContainerVm(ContainerVm containerVm) {
        if (getContainerVmRamTable().containsKey(containerVm.getUid())) {
            float amountFreed = getContainerVmRamTable().remove(containerVm.getUid());
            setAvailableRam(getAvailableRam() + amountFreed);
            containerVm.setCurrentAllocatedRam(0);
        }

    }

    @Override
    public void deallocateRamForAllContainerVms() {
        super.deallocateRamForAllContainerVms();
        getContainerVmRamTable().clear();
    }

    @Override
    public boolean isSuitableForContainerVm(ContainerVm containerVm, float ram) {
        float allocatedRam = getAllocatedRamForContainerVm(containerVm);
        boolean result = allocateRamForContainerVm(containerVm, ram);
        deallocateRamForContainerVm(containerVm);
        if (allocatedRam > 0) {
            allocateRamForContainerVm(containerVm, allocatedRam);
        }
        return result;
    }

    /**
     * @return the containerVmRamTable
     */
    protected Map<String, Float> getContainerVmRamTable() {
        return containerVmRamTable;
    }

    /**
     * @param containerVmRamTable the containerVmRamTable to set
     */
    protected void setContainerVmRamTable(Map<String, Float> containerVmRamTable) {
        this.containerVmRamTable = containerVmRamTable;
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical">
    <TextView
            android:id="@+id/textview_mainscr_cat_language"
            style="?android:attr/listSeparatorTextViewStyle"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="@dimen/padding_list_item_leftright"
            android:paddingRight="@dimen/padding_list_item_leftright"
            android:textSize="@dimen/text_size_list_item_secondary"
            android:textColor="@color/textSecondary"/>

    <TextView
            android:id="@+id/textview_mainscr_cat_name"
            android:layout_width="fill_parent"
            android:layout_height="@dimen/height_list_item_oneline"
            android:paddingLeft="@dimen/padding_list_item_leftright"
            android:paddingRight="@dimen/padding_list_item_leftright"
            android:paddingTop="@dimen/padding_list_item_topbottom_small"
            android:paddingBottom="@dimen/padding_list_item_topbottom_small"
            android:gravity="center_vertical"
            android:singleLine="true"
            android:textColor="@color/textPrimary"
            android:textSize="@dimen/text_size_list_item_primary"
            android:textStyle="bold"/>

</LinearLayout>


text:
package com.tlf.msg.admin.domain;

public class PermissionInfo {

	private String businessCode;
	private String businessName;
	private String templateCode;
	private String templateName;

	public String getBusinessCode() {
		return businessCode;
	}

	public void setBusinessCode(String businessCode) {
		this.businessCode = businessCode;
	}

	public String getBusinessName() {
		return businessName;
	}

	public void setBusinessName(String businessName) {
		this.businessName = businessName;
	}

	public String getTemplateCode() {
		return templateCode;
	}

	public void setTemplateCode(String templateCode) {
		this.templateCode = templateCode;
	}

	public String getTemplateName() {
		return templateName;
	}

	public void setTemplateName(String templateName) {
		this.templateName = templateName;
	}

}


text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />

<link rel="shortcut icon" type="image/x-icon" href="../../../../../favicon.ico" />
<title>WifiP2pManager - Android SDK | Android Developers</title>

<link rel="stylesheet"
href="http://fonts.googleapis.com/css?family=Roboto:regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="../../../../../assets/css/default.css" rel="stylesheet" type="text/css">

<link href="../../../../../assets/css/fullscreen.css" rel="stylesheet" class="fullscreen"
type="text/css">

          	Quicknav
			      Quicknav

                  Design

Develop

Distribute

Links

Google Play Developer Console

Android Developers Blog

About Android

Android Sites

Android.com

Android Developers

Android Open Source Project

      <form onsubmit="return submit_search()">
        <input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '../../../../../')"
onkeyup="return search_changed(event, false, '../../../../../')" />
      </form>

        close

Get Started

Style

Patterns

Building Blocks

Downloads

Videos

Training

API Guides

Reference

Tools

Get the SDK

Google Services

Google Play

Publishing

Promoting

App Quality

Spotlight

Open Distribution

Results

Loading...

Training

API Guides

Reference

Tools

Google Services

to top

          API level:

            <select id="apiLevelSelector">

            </select>

Android APIs

  android

  android.accessibilityservice

  android.accounts

  android.animation

  android.app

  android.app.admin

  android.app.backup

  android.appwidget

  android.bluetooth

  android.content

  android.content.pm

  android.content.res

  android.database

  android.database.sqlite

  android.drm

  android.gesture

  android.graphics

  android.graphics.drawable

  android.graphics.drawable.shapes

  android.graphics.pdf

  android.hardware

  android.hardware.display

  android.hardware.input

  android.hardware.location

  android.hardware.usb

  android.inputmethodservice

  android.location

  android.media

  android.media.audiofx

  android.media.effect

  android.mtp

  android.net

  android.net.http

  android.net.nsd

  android.net.rtp

  android.net.sip

  android.net.wifi

  android.net.wifi.p2p

  android.net.wifi.p2p.nsd

  android.nfc

  android.nfc.cardemulation

  android.nfc.tech

  android.opengl

  android.os

  android.os.storage

  android.preference

  android.print

  android.print.pdf

  android.printservice

  android.provider

  android.renderscript

  android.sax

  android.security

  android.service.dreams

  android.service.notification

  android.service.textservice

  android.service.wallpaper

  android.speech

  android.speech.tts

  android.support.v13.app

  android.support.v4.accessibilityservice

  android.support.v4.app

  android.support.v4.content

  android.support.v4.content.pm

  android.support.v4.database

  android.support.v4.graphics.drawable

  android.support.v4.hardware.display

  android.support.v4.media

  android.support.v4.net

  android.support.v4.os

  android.support.v4.print

  android.support.v4.text

  android.support.v4.util

  android.support.v4.view

  android.support.v4.view.accessibility

  android.support.v4.widget

  android.support.v7.app

  android.support.v7.appcompat

  android.support.v7.gridlayout

  android.support.v7.media

  android.support.v7.mediarouter

  android.support.v7.view

  android.support.v7.widget

  android.support.v8.renderscript

  android.telephony

  android.telephony.cdma

  android.telephony.gsm

  android.test

  android.test.mock

  android.test.suitebuilder

  android.text

  android.text.format

  android.text.method

  android.text.style

  android.text.util

  android.transition

  android.util

  android.view

  android.view.accessibility

  android.view.animation

  android.view.inputmethod

  android.view.textservice

  android.webkit

  android.widget

  dalvik.bytecode

  dalvik.system

  java.awt.font

  java.beans

  java.io

  java.lang

  java.lang.annotation

  java.lang.ref

  java.lang.reflect

  java.math

  java.net

  java.nio

  java.nio.channels

  java.nio.channels.spi

  java.nio.charset

  java.nio.charset.spi

  java.security

  java.security.acl

  java.security.cert

  java.security.interfaces

  java.security.spec

  java.sql

  java.text

  java.util

  java.util.concurrent

  java.util.concurrent.atomic

  java.util.concurrent.locks

  java.util.jar

  java.util.logging

  java.util.prefs

  java.util.regex

  java.util.zip

  javax.crypto

  javax.crypto.interfaces

  javax.crypto.spec

  javax.microedition.khronos.egl

  javax.microedition.khronos.opengles

  javax.net

  javax.net.ssl

  javax.security.auth

  javax.security.auth.callback

  javax.security.auth.login

  javax.security.auth.x500

  javax.security.cert

  javax.sql

  javax.xml

  javax.xml.datatype

  javax.xml.namespace

  javax.xml.parsers

  javax.xml.transform

  javax.xml.transform.dom

  javax.xml.transform.sax

  javax.xml.transform.stream

  javax.xml.validation

  javax.xml.xpath

  junit.framework

  junit.runner

  org.apache.http

  org.apache.http.auth

  org.apache.http.auth.params

  org.apache.http.client

  org.apache.http.client.entity

  org.apache.http.client.methods

  org.apache.http.client.params

  org.apache.http.client.protocol

  org.apache.http.client.utils

  org.apache.http.conn

  org.apache.http.conn.params

  org.apache.http.conn.routing

  org.apache.http.conn.scheme

  org.apache.http.conn.ssl

  org.apache.http.conn.util

  org.apache.http.cookie

  org.apache.http.cookie.params

  org.apache.http.entity

  org.apache.http.impl

  org.apache.http.impl.auth

  org.apache.http.impl.client

  org.apache.http.impl.conn

  org.apache.http.impl.conn.tsccm

  org.apache.http.impl.cookie

  org.apache.http.impl.entity

  org.apache.http.impl.io

  org.apache.http.io

  org.apache.http.message

  org.apache.http.params

  org.apache.http.protocol

  org.apache.http.util

  org.json

  org.w3c.dom

  org.w3c.dom.ls

  org.xml.sax

  org.xml.sax.ext

  org.xml.sax.helpers

  org.xmlpull.v1

  org.xmlpull.v1.sax2

Interfaces

WifiP2pManager.ActionListener

WifiP2pManager.ChannelListener

WifiP2pManager.ConnectionInfoListener

WifiP2pManager.DnsSdServiceResponseListener

WifiP2pManager.DnsSdTxtRecordListener

WifiP2pManager.GroupInfoListener

WifiP2pManager.PeerListListener

WifiP2pManager.ServiceResponseListener

WifiP2pManager.UpnpServiceResponseListener

Classes

WifiP2pConfig

WifiP2pDevice

WifiP2pDeviceList

WifiP2pGroup

WifiP2pInfo

WifiP2pManager

WifiP2pManager.Channel

      fullscreen
      Use Tree NavigationUse Panel Navigation

Summary:

  Nested Classes

  | Constants

  | Methods

  | Inherited Methods

| [Expand All]

  Added in API level 14

    public

    class

WifiP2pManager

    extends Object

        java.lang.Object

               ↳

        android.net.wifi.p2p.WifiP2pManager

Class Overview

This class provides the API for managing Wi-Fi peer-to-peer connectivity. This lets an
 application discover available peers, setup connection to peers and query for the list of peers.
 When a p2p connection is formed over wifi, the device continues to maintain the uplink
 connection over mobile or any other available network for internet connectivity on the device.

 The API is asynchronous and responses to requests from an application are on listener
 callbacks provided by the application. The application needs to do an initialization with
 initialize(Context, Looper, WifiP2pManager.ChannelListener) before doing any p2p operation.

 Most application calls need a WifiP2pManager.ActionListener instance for receiving callbacks
 onSuccess() or onFailure(int). Action callbacks
 indicate whether the initiation of the action was a success or a failure.
 Upon failure, the reason of failure can be one of ERROR, P2P_UNSUPPORTED
 or BUSY.

 An application can initiate discovery of peers with discoverPeers(WifiP2pManager.Channel, WifiP2pManager.ActionListener). An initiated
 discovery request from an application stays active until the device starts connecting to a peer
 ,forms a p2p group or there is an explicit stopPeerDiscovery(WifiP2pManager.Channel, WifiP2pManager.ActionListener).
 Applications can listen to WIFI_P2P_DISCOVERY_CHANGED_ACTION to know if a peer-to-peer
 discovery is running or stopped. Additionally, WIFI_P2P_PEERS_CHANGED_ACTION indicates
 if the peer list has changed.

 When an application needs to fetch the current list of peers, it can request the list
 of peers with requestPeers(WifiP2pManager.Channel, WifiP2pManager.PeerListListener). When the peer list is available
 onPeersAvailable(WifiP2pDeviceList) is called with the device list.

 An application can initiate a connection request to a peer through connect(WifiP2pManager.Channel, WifiP2pConfig, WifiP2pManager.ActionListener). See
 WifiP2pConfig for details on setting up the configuration. For communication with legacy
 Wi-Fi devices that do not support p2p, an app can create a group using createGroup(WifiP2pManager.Channel, WifiP2pManager.ActionListener)
 which creates an access point whose details can be fetched with requestGroupInfo(WifiP2pManager.Channel, WifiP2pManager.GroupInfoListener).

 After a successful group formation through createGroup(WifiP2pManager.Channel, WifiP2pManager.ActionListener) or through connect(WifiP2pManager.Channel, WifiP2pConfig, WifiP2pManager.ActionListener),
 use requestConnectionInfo(WifiP2pManager.Channel, WifiP2pManager.ConnectionInfoListener) to fetch the connection details. The connection info
 WifiP2pInfo contains the address of the group owner
 groupOwnerAddress and a flag isGroupOwner to indicate
 if the current device is a p2p group owner. A p2p client can thus communicate with
 the p2p group owner through a socket connection.

 With peer discovery using discoverPeers(WifiP2pManager.Channel, WifiP2pManager.ActionListener), an application discovers the neighboring
 peers, but has no good way to figure out which peer to establish a connection with. For example,
 if a game application is interested in finding all the neighboring peers that are also running
 the same game, it has no way to find out until after the connection is setup. Pre-association
 service discovery is meant to address this issue of filtering the peers based on the running
 services.

With pre-association service discovery, an application can advertise a service for a
 application on a peer device prior to a connection setup between the devices.
 Currently, DNS based service discovery (Bonjour) and Upnp are the higher layer protocols
 supported. Get Bonjour resources at dns-sd.org and Upnp resources at upnp.org
 As an example, a video application can discover a Upnp capable media renderer
 prior to setting up a Wi-fi p2p connection with the device.

 An application can advertise a Upnp or a Bonjour service with a call to
 addLocalService(WifiP2pManager.Channel, WifiP2pServiceInfo, WifiP2pManager.ActionListener). After a local service is added,
 the framework automatically responds to a peer application discovering the service prior
 to establishing a p2p connection. A call to removeLocalService(WifiP2pManager.Channel, WifiP2pServiceInfo, WifiP2pManager.ActionListener) removes a local
 service and clearLocalServices(WifiP2pManager.Channel, WifiP2pManager.ActionListener) can be used to clear all local services.

 An application that is looking for peer devices that support certain services
 can do so with a call to  discoverServices(WifiP2pManager.Channel, WifiP2pManager.ActionListener). Prior to initiating the discovery,
 application can add service discovery request with a call to addServiceRequest(WifiP2pManager.Channel, WifiP2pServiceRequest, WifiP2pManager.ActionListener),
 remove a service discovery request with a call to removeServiceRequest(WifiP2pManager.Channel, WifiP2pServiceRequest, WifiP2pManager.ActionListener) or clear
 all requests with a call to clearServiceRequests(WifiP2pManager.Channel, WifiP2pManager.ActionListener). When no service requests remain,
 a previously running service discovery will stop.

 The application is notified of a result of service discovery request through listener callbacks
 set through setDnsSdResponseListeners(WifiP2pManager.Channel, WifiP2pManager.DnsSdServiceResponseListener, WifiP2pManager.DnsSdTxtRecordListener) for Bonjour or
 setUpnpServiceResponseListener(WifiP2pManager.Channel, WifiP2pManager.UpnpServiceResponseListener) for Upnp.

Note:
 Registering an application handler with initialize(Context, Looper, WifiP2pManager.ChannelListener) requires the permissions
 ACCESS_WIFI_STATE and
 CHANGE_WIFI_STATE to perform any further peer-to-peer
 operations.

 Get an instance of this class by calling Context.getSystemService(Context.WIFI_P2P_SERVICE).

See Also

WifiP2pConfig

WifiP2pInfo

WifiP2pGroup

WifiP2pDevice

WifiP2pDeviceList

WpsInfo

Summary

Nested Classes

      <nobr>

        interface</nobr>
      WifiP2pManager.ActionListener
      Interface for callback invocation on an application action

      <nobr>

        class</nobr>
      WifiP2pManager.Channel
      A channel that connects the application to the Wifi p2p framework.

      <nobr>

        interface</nobr>
      WifiP2pManager.ChannelListener
      Interface for callback invocation when framework channel is lost

      <nobr>

        interface</nobr>
      WifiP2pManager.ConnectionInfoListener
      Interface for callback invocation when connection info is available

      <nobr>

        interface</nobr>
      WifiP2pManager.DnsSdServiceResponseListener
      Interface for callback invocation when Bonjour service discovery response
 is received

      <nobr>

        interface</nobr>
      WifiP2pManager.DnsSdTxtRecordListener
      Interface for callback invocation when Bonjour TXT record is available
 for a service

      <nobr>

        interface</nobr>
      WifiP2pManager.GroupInfoListener
      Interface for callback invocation when group info is available

      <nobr>

        interface</nobr>
      WifiP2pManager.PeerListListener
      Interface for callback invocation when peer list is available

      <nobr>

        interface</nobr>
      WifiP2pManager.ServiceResponseListener
      Interface for callback invocation when service discovery response other than
 Upnp or Bonjour is received

      <nobr>

        interface</nobr>
      WifiP2pManager.UpnpServiceResponseListener
      Interface for callback invocation when upnp service discovery response
 is received

Constants

        int
        BUSY
        Passed with onFailure(int).

        int
        ERROR
        Passed with onFailure(int).

        String
        EXTRA_DISCOVERY_STATE
        The lookup key for an int that indicates whether p2p discovery has started or stopped.

        String
        EXTRA_NETWORK_INFO
        The lookup key for a NetworkInfo object associated with the
 p2p network.

        String
        EXTRA_P2P_DEVICE_LIST
        The lookup key for a WifiP2pDeviceList object representing
 the new peer list when WIFI_P2P_PEERS_CHANGED_ACTION broadcast is sent.

        String
        EXTRA_WIFI_P2P_DEVICE
        The lookup key for a WifiP2pDevice object
 Retrieve with getParcelableExtra(String).

        String
        EXTRA_WIFI_P2P_GROUP
        The lookup key for a WifiP2pGroup object
 associated with the p2p network.

        String
        EXTRA_WIFI_P2P_INFO
        The lookup key for a WifiP2pInfo object
 Retrieve with getParcelableExtra(String).

        String
        EXTRA_WIFI_STATE
        The lookup key for an int that indicates whether Wi-Fi p2p is enabled or disabled.

        int
        NO_SERVICE_REQUESTS
        Passed with onFailure(int).

        int
        P2P_UNSUPPORTED
        Passed with onFailure(int).

        String
        WIFI_P2P_CONNECTION_CHANGED_ACTION
        Broadcast intent action indicating that the state of Wi-Fi p2p connectivity
 has changed.

        String
        WIFI_P2P_DISCOVERY_CHANGED_ACTION
        Broadcast intent action indicating that peer discovery has either started or stopped.

        int
        WIFI_P2P_DISCOVERY_STARTED
        p2p discovery has started

        int
        WIFI_P2P_DISCOVERY_STOPPED
        p2p discovery has stopped

        String
        WIFI_P2P_PEERS_CHANGED_ACTION
        Broadcast intent action indicating that the available peer list has changed.

        String
        WIFI_P2P_STATE_CHANGED_ACTION
        Broadcast intent action to indicate whether Wi-Fi p2p is enabled or disabled.

        int
        WIFI_P2P_STATE_DISABLED
        Wi-Fi p2p is disabled.

        int
        WIFI_P2P_STATE_ENABLED
        Wi-Fi p2p is enabled.

        String
        WIFI_P2P_THIS_DEVICE_CHANGED_ACTION
        Broadcast intent action indicating that this device details have changed.

Public Methods

        <nobr>

            void</nobr>

        <nobr>
        addLocalService(WifiP2pManager.Channel c, WifiP2pServiceInfo servInfo, WifiP2pManager.ActionListener listener)</nobr>

Register a local service for service discovery.

        <nobr>

            void</nobr>

        <nobr>
        addServiceRequest(WifiP2pManager.Channel c, WifiP2pServiceRequest req, WifiP2pManager.ActionListener listener)</nobr>

Add a service discovery request.

        <nobr>

            void</nobr>

        <nobr>
        cancelConnect(WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener)</nobr>

Cancel any ongoing p2p group negotiation

 The function call immediately returns after sending a connection cancellation request
 to the framework.

        <nobr>

            void</nobr>

        <nobr>
        clearLocalServices(WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener)</nobr>

Clear all registered local services of service discovery.

        <nobr>

            void</nobr>

        <nobr>
        clearServiceRequests(WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener)</nobr>

Clear all registered service discovery requests.

        <nobr>

            void</nobr>

        <nobr>
        connect(WifiP2pManager.Channel c, WifiP2pConfig config, WifiP2pManager.ActionListener listener)</nobr>

Start a p2p connection to a device with the specified configuration.

        <nobr>

            void</nobr>

        <nobr>
        createGroup(WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener)</nobr>

Create a p2p group with the current device as the group owner.

        <nobr>

            void</nobr>

        <nobr>
        discoverPeers(WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener)</nobr>

Initiate peer discovery.

        <nobr>

            void</nobr>

        <nobr>
        discoverServices(WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener)</nobr>

Initiate service discovery.

        <nobr>

            WifiP2pManager.Channel</nobr>

        <nobr>
        initialize(Context srcContext, Looper srcLooper, WifiP2pManager.ChannelListener listener)</nobr>

Registers the application with the Wi-Fi framework.

        <nobr>

            void</nobr>

        <nobr>
        removeGroup(WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener)</nobr>

Remove the current p2p group.

        <nobr>

            void</nobr>

        <nobr>
        removeLocalService(WifiP2pManager.Channel c, WifiP2pServiceInfo servInfo, WifiP2pManager.ActionListener listener)</nobr>

Remove a registered local service added with addLocalService(WifiP2pManager.Channel, WifiP2pServiceInfo, WifiP2pManager.ActionListener)

 The function call immediately returns after sending a request to remove a
 local service to the framework.

        <nobr>

            void</nobr>

        <nobr>
        removeServiceRequest(WifiP2pManager.Channel c, WifiP2pServiceRequest req, WifiP2pManager.ActionListener listener)</nobr>

Remove a specified service discovery request added with addServiceRequest(WifiP2pManager.Channel, WifiP2pServiceRequest, WifiP2pManager.ActionListener)

 The function call immediately returns after sending a request to remove service
 discovery request to the framework.

        <nobr>

            void</nobr>

        <nobr>
        requestConnectionInfo(WifiP2pManager.Channel c, WifiP2pManager.ConnectionInfoListener listener)</nobr>

Request device connection info.

        <nobr>

            void</nobr>

        <nobr>
        requestGroupInfo(WifiP2pManager.Channel c, WifiP2pManager.GroupInfoListener listener)</nobr>

Request p2p group info.

        <nobr>

            void</nobr>

        <nobr>
        requestPeers(WifiP2pManager.Channel c, WifiP2pManager.PeerListListener listener)</nobr>

Request the current list of peers.

        <nobr>

            void</nobr>

        <nobr>
        setDnsSdResponseListeners(WifiP2pManager.Channel c, WifiP2pManager.DnsSdServiceResponseListener servListener, WifiP2pManager.DnsSdTxtRecordListener txtListener)</nobr>

Register a callback to be invoked on receiving Bonjour service discovery
 response.

        <nobr>

            void</nobr>

        <nobr>
        setServiceResponseListener(WifiP2pManager.Channel c, WifiP2pManager.ServiceResponseListener listener)</nobr>

Register a callback to be invoked on receiving service discovery response.

        <nobr>

            void</nobr>

        <nobr>
        setUpnpServiceResponseListener(WifiP2pManager.Channel c, WifiP2pManager.UpnpServiceResponseListener listener)</nobr>

Register a callback to be invoked on receiving upnp service discovery
 response.

        <nobr>

            void</nobr>

        <nobr>
        stopPeerDiscovery(WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener)</nobr>

Stop an ongoing peer discovery

 The function call immediately returns after sending a stop request
 to the framework.

  [Expand]

Inherited Methods

From class

  java.lang.Object

        <nobr>

            Object</nobr>

        <nobr>
        clone()</nobr>

Creates and returns a copy of this Object.

        <nobr>

            boolean</nobr>

        <nobr>
        equals(Object o)</nobr>

Compares this instance with the specified object and indicates if they
 are equal.

        <nobr>

            void</nobr>

        <nobr>
        finalize()</nobr>

Invoked when the garbage collector has detected that this instance is no longer reachable.

        <nobr>

            final

            Class<?></nobr>

        <nobr>
        getClass()</nobr>

Returns the unique instance of Class that represents this
 object's class.

        <nobr>

            int</nobr>

        <nobr>
        hashCode()</nobr>

Returns an integer hash code for this object.

        <nobr>

            final

            void</nobr>

        <nobr>
        notify()</nobr>

Causes a thread which is waiting on this object's monitor (by means of
 calling one of the wait() methods) to be woken up.

        <nobr>

            final

            void</nobr>

        <nobr>
        notifyAll()</nobr>

Causes all threads which are waiting on this object's monitor (by means
 of calling one of the wait() methods) to be woken up.

        <nobr>

            String</nobr>

        <nobr>
        toString()</nobr>

Returns a string containing a concise, human-readable description of this
 object.

        <nobr>

            final

            void</nobr>

        <nobr>
        wait()</nobr>

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

        <nobr>

            final

            void</nobr>

        <nobr>
        wait(long millis, int nanos)</nobr>

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
 specified timeout expires.

        <nobr>

            final

            void</nobr>

        <nobr>
        wait(long millis)</nobr>

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
 specified timeout expires.

Constants

        public
        static
        final
        int

        BUSY

  Added in API level 14

Passed with onFailure(int).
 Indicates that the operation failed because the framework is busy and
 unable to service the request

        Constant Value:

                2
                (0x00000002)

        public
        static
        final
        int

        ERROR

  Added in API level 14

Passed with onFailure(int).
 Indicates that the operation failed due to an internal error.

        Constant Value:

                0
                (0x00000000)

        public
        static
        final
        String

        EXTRA_DISCOVERY_STATE

  Added in API level 16

The lookup key for an int that indicates whether p2p discovery has started or stopped.
 Retrieve it with getIntExtra(String, int).

See Also

WIFI_P2P_DISCOVERY_STARTED

WIFI_P2P_DISCOVERY_STOPPED

        Constant Value:

                "discoveryState"

        public
        static
        final
        String

        EXTRA_NETWORK_INFO

  Added in API level 14

The lookup key for a NetworkInfo object associated with the
 p2p network. Retrieve with
 getParcelableExtra(String).

        Constant Value:

                "networkInfo"

        public
        static
        final
        String

        EXTRA_P2P_DEVICE_LIST

  Added in API level 18

The lookup key for a WifiP2pDeviceList object representing
 the new peer list when WIFI_P2P_PEERS_CHANGED_ACTION broadcast is sent.

Retrieve with getParcelableExtra(String).

        Constant Value:

                "wifiP2pDeviceList"

        public
        static
        final
        String

        EXTRA_WIFI_P2P_DEVICE

  Added in API level 14

The lookup key for a WifiP2pDevice object
 Retrieve with getParcelableExtra(String).

        Constant Value:

                "wifiP2pDevice"

        public
        static
        final
        String

        EXTRA_WIFI_P2P_GROUP

  Added in API level 18

The lookup key for a WifiP2pGroup object
 associated with the p2p network. Retrieve with
 getParcelableExtra(String).

        Constant Value:

                "p2pGroupInfo"

        public
        static
        final
        String

        EXTRA_WIFI_P2P_INFO

  Added in API level 14

The lookup key for a WifiP2pInfo object
 Retrieve with getParcelableExtra(String).

        Constant Value:

                "wifiP2pInfo"

        public
        static
        final
        String

        EXTRA_WIFI_STATE

  Added in API level 14

The lookup key for an int that indicates whether Wi-Fi p2p is enabled or disabled.
 Retrieve it with getIntExtra(String, int).

See Also

WIFI_P2P_STATE_DISABLED

WIFI_P2P_STATE_ENABLED

        Constant Value:

                "wifi_p2p_state"

        public
        static
        final
        int

        NO_SERVICE_REQUESTS

  Added in API level 16

Passed with onFailure(int).
 Indicates that the discoverServices(WifiP2pManager.Channel, WifiP2pManager.ActionListener) failed because no service
 requests are added. Use addServiceRequest(WifiP2pManager.Channel, WifiP2pServiceRequest, WifiP2pManager.ActionListener) to add a service
 request.

        Constant Value:

                3
                (0x00000003)

        public
        static
        final
        int

        P2P_UNSUPPORTED

  Added in API level 14

Passed with onFailure(int).
 Indicates that the operation failed because p2p is unsupported on the device.

        Constant Value:

                1
                (0x00000001)

        public
        static
        final
        String

        WIFI_P2P_CONNECTION_CHANGED_ACTION

  Added in API level 14

Broadcast intent action indicating that the state of Wi-Fi p2p connectivity
 has changed. One extra EXTRA_WIFI_P2P_INFO provides the p2p connection info in
 the form of a WifiP2pInfo object. Another extra EXTRA_NETWORK_INFO provides
 the network info in the form of a NetworkInfo. A third extra provides
 the details of the group.

See Also

EXTRA_WIFI_P2P_INFO

EXTRA_NETWORK_INFO

EXTRA_WIFI_P2P_GROUP

        Constant Value:

                "android.net.wifi.p2p.CONNECTION_STATE_CHANGE"

        public
        static
        final
        String

        WIFI_P2P_DISCOVERY_CHANGED_ACTION

  Added in API level 16

Broadcast intent action indicating that peer discovery has either started or stopped.
 One extra EXTRA_DISCOVERY_STATE indicates whether discovery has started
 or stopped.

Note that discovery will be stopped during a connection setup. If the application tries
 to re-initiate discovery during this time, it can fail.

        Constant Value:

                "android.net.wifi.p2p.DISCOVERY_STATE_CHANGE"

        public
        static
        final
        int

        WIFI_P2P_DISCOVERY_STARTED

  Added in API level 16

p2p discovery has started

See Also

WIFI_P2P_DISCOVERY_CHANGED_ACTION

        Constant Value:

                2
                (0x00000002)

        public
        static
        final
        int

        WIFI_P2P_DISCOVERY_STOPPED

  Added in API level 16

p2p discovery has stopped

See Also

WIFI_P2P_DISCOVERY_CHANGED_ACTION

        Constant Value:

                1
                (0x00000001)

        public
        static
        final
        String

        WIFI_P2P_PEERS_CHANGED_ACTION

  Added in API level 14

Broadcast intent action indicating that the available peer list has changed. This
 can be sent as a result of peers being found, lost or updated.

 An extra EXTRA_P2P_DEVICE_LIST provides the full list of
 current peers. The full list of peers can also be obtained any time with
 requestPeers(WifiP2pManager.Channel, WifiP2pManager.PeerListListener).

See Also

EXTRA_P2P_DEVICE_LIST

        Constant Value:

                "android.net.wifi.p2p.PEERS_CHANGED"

        public
        static
        final
        String

        WIFI_P2P_STATE_CHANGED_ACTION

  Added in API level 14

Broadcast intent action to indicate whether Wi-Fi p2p is enabled or disabled. An
 extra EXTRA_WIFI_STATE provides the state information as int.

See Also

EXTRA_WIFI_STATE

        Constant Value:

                "android.net.wifi.p2p.STATE_CHANGED"

        public
        static
        final
        int

        WIFI_P2P_STATE_DISABLED

  Added in API level 14

Wi-Fi p2p is disabled.

See Also

WIFI_P2P_STATE_CHANGED_ACTION

        Constant Value:

                1
                (0x00000001)

        public
        static
        final
        int

        WIFI_P2P_STATE_ENABLED

  Added in API level 14

Wi-Fi p2p is enabled.

See Also

WIFI_P2P_STATE_CHANGED_ACTION

        Constant Value:

                2
                (0x00000002)

        public
        static
        final
        String

        WIFI_P2P_THIS_DEVICE_CHANGED_ACTION

  Added in API level 14

Broadcast intent action indicating that this device details have changed.

        Constant Value:

                "android.net.wifi.p2p.THIS_DEVICE_CHANGED"

Public Methods

        public

        void

      addLocalService
      (WifiP2pManager.Channel c, WifiP2pServiceInfo servInfo, WifiP2pManager.ActionListener listener)

  Added in API level 16

Register a local service for service discovery. If a local service is registered,
 the framework automatically responds to a service discovery request from a peer.

 The function call immediately returns after sending a request to add a local
 service to the framework. The application is notified of a success or failure to
 add service through listener callbacks onSuccess() or
 onFailure(int).

The service information is set through WifiP2pServiceInfo.

 or its subclass calls  <a href="../../../../../reference/android/net/wifi/p2p/nsd/WifiP2pUpnpServiceInfo.html#newInstance(java.lang.String, java.lang.String, java.util.List<java.lang.String>)">newInstance(String, String, List<String>) or
  <a href="../../../../../reference/android/net/wifi/p2p/nsd/WifiP2pDnsSdServiceInfo.html#newInstance(java.lang.String, java.lang.String, java.util.Map<java.lang.String, java.lang.String>)">newInstance(String, String, Map<String, String>) for a Upnp or Bonjour service
 respectively

The service information can be cleared with calls to
  removeLocalService(WifiP2pManager.Channel, WifiP2pServiceInfo, WifiP2pManager.ActionListener) or clearLocalServices(WifiP2pManager.Channel, WifiP2pManager.ActionListener).

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          servInfo
          is a local service information.

          listener
          for callbacks on success or failure. Can be null.

        public

        void

      addServiceRequest
      (WifiP2pManager.Channel c, WifiP2pServiceRequest req, WifiP2pManager.ActionListener listener)

  Added in API level 16

Add a service discovery request.

 The function call immediately returns after sending a request to add service
 discovery request to the framework. The application is notified of a success or failure to
 add service through listener callbacks onSuccess() or
 onFailure(int).

After service discovery request is added, you can initiate service discovery by
 discoverServices(WifiP2pManager.Channel, WifiP2pManager.ActionListener).

The added service requests can be cleared with calls to
 removeServiceRequest(Channel, WifiP2pServiceRequest, ActionListener) or
 clearServiceRequests(Channel, ActionListener).

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          req
          is the service discovery request.

          listener
          for callbacks on success or failure. Can be null.

        public

        void

      cancelConnect
      (WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener)

  Added in API level 14

Cancel any ongoing p2p group negotiation

 The function call immediately returns after sending a connection cancellation request
 to the framework. The application is notified of a success or failure to initiate
 cancellation through listener callbacks onSuccess() or
 onFailure(int).

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          listener
          for callbacks on success or failure. Can be null.

        public

        void

      clearLocalServices
      (WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener)

  Added in API level 16

Clear all registered local services of service discovery.

 The function call immediately returns after sending a request to clear all
 local services to the framework. The application is notified of a success or failure to
 add service through listener callbacks onSuccess() or
 onFailure(int).

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          listener
          for callbacks on success or failure. Can be null.

        public

        void

      clearServiceRequests
      (WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener)

  Added in API level 16

Clear all registered service discovery requests.

 The function call immediately returns after sending a request to clear all
 service discovery requests to the framework. The application is notified of a success
 or failure to add service through listener callbacks onSuccess() or
 onFailure(int).

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          listener
          for callbacks on success or failure. Can be null.

        public

        void

      connect
      (WifiP2pManager.Channel c, WifiP2pConfig config, WifiP2pManager.ActionListener listener)

  Added in API level 14

Start a p2p connection to a device with the specified configuration.

 The function call immediately returns after sending a connection request
 to the framework. The application is notified of a success or failure to initiate
 connect through listener callbacks onSuccess() or
 onFailure(int).

 Register for WIFI_P2P_CONNECTION_CHANGED_ACTION intent to
 determine when the framework notifies of a change in connectivity.

 If the current device is not part of a p2p group, a connect request initiates
 a group negotiation with the peer.

 If the current device is part of an existing p2p group or has created
 a p2p group with createGroup(WifiP2pManager.Channel, WifiP2pManager.ActionListener), an invitation to join the group is sent to
 the peer device.

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          config
          options as described in WifiP2pConfig class

          listener
          for callbacks on success or failure. Can be null.

        public

        void

      createGroup
      (WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener)

  Added in API level 14

Create a p2p group with the current device as the group owner. This essentially creates
 an access point that can accept connections from legacy clients as well as other p2p
 devices.

Note:
 This function would normally not be used unless the current device needs
 to form a p2p connection with a legacy client

 The function call immediately returns after sending a group creation request
 to the framework. The application is notified of a success or failure to initiate
 group creation through listener callbacks onSuccess() or
 onFailure(int).

 Application can request for the group details with requestGroupInfo(WifiP2pManager.Channel, WifiP2pManager.GroupInfoListener).

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          listener
          for callbacks on success or failure. Can be null.

        public

        void

      discoverPeers
      (WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener)

  Added in API level 14

Initiate peer discovery. A discovery process involves scanning for available Wi-Fi peers
 for the purpose of establishing a connection.

 The function call immediately returns after sending a discovery request
 to the framework. The application is notified of a success or failure to initiate
 discovery through listener callbacks onSuccess() or
 onFailure(int).

 The discovery remains active until a connection is initiated or
 a p2p group is formed. Register for WIFI_P2P_PEERS_CHANGED_ACTION intent to
 determine when the framework notifies of a change as peers are discovered.

 Upon receiving a WIFI_P2P_PEERS_CHANGED_ACTION intent, an application
 can request for the list of peers using requestPeers(WifiP2pManager.Channel, WifiP2pManager.PeerListListener).

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          listener
          for callbacks on success or failure. Can be null.

        public

        void

      discoverServices
      (WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener)

  Added in API level 16

Initiate service discovery. A discovery process involves scanning for
 requested services for the purpose of establishing a connection to a peer
 that supports an available service.

 The function call immediately returns after sending a request to start service
 discovery to the framework. The application is notified of a success or failure to initiate
 discovery through listener callbacks onSuccess() or
 onFailure(int).

 The services to be discovered are specified with calls to addServiceRequest(WifiP2pManager.Channel, WifiP2pServiceRequest, WifiP2pManager.ActionListener).

The application is notified of the response against the service discovery request
 through listener callbacks registered by setServiceResponseListener(WifiP2pManager.Channel, WifiP2pManager.ServiceResponseListener) or
 setDnsSdResponseListeners(WifiP2pManager.Channel, WifiP2pManager.DnsSdServiceResponseListener, WifiP2pManager.DnsSdTxtRecordListener), or setUpnpServiceResponseListener(WifiP2pManager.Channel, WifiP2pManager.UpnpServiceResponseListener).

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          listener
          for callbacks on success or failure. Can be null.

        public

        WifiP2pManager.Channel

      initialize
      (Context srcContext, Looper srcLooper, WifiP2pManager.ChannelListener listener)

  Added in API level 14

Registers the application with the Wi-Fi framework. This function
 must be the first to be called before any p2p operations are performed.

Parameters

          srcContext
          is the context of the source

          srcLooper
          is the Looper on which the callbacks are receivied

          listener
          for callback at loss of framework communication. Can be null.

Returns

Channel instance that is necessary for performing any further p2p operations

        public

        void

      removeGroup
      (WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener)

  Added in API level 14

Remove the current p2p group.

 The function call immediately returns after sending a group removal request
 to the framework. The application is notified of a success or failure to initiate
 group removal through listener callbacks onSuccess() or
 onFailure(int).

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          listener
          for callbacks on success or failure. Can be null.

        public

        void

      removeLocalService
      (WifiP2pManager.Channel c, WifiP2pServiceInfo servInfo, WifiP2pManager.ActionListener listener)

  Added in API level 16

Remove a registered local service added with addLocalService(WifiP2pManager.Channel, WifiP2pServiceInfo, WifiP2pManager.ActionListener)

 The function call immediately returns after sending a request to remove a
 local service to the framework. The application is notified of a success or failure to
 add service through listener callbacks onSuccess() or
 onFailure(int).

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          servInfo
          is the local service information.

          listener
          for callbacks on success or failure. Can be null.

        public

        void

      removeServiceRequest
      (WifiP2pManager.Channel c, WifiP2pServiceRequest req, WifiP2pManager.ActionListener listener)

  Added in API level 16

Remove a specified service discovery request added with addServiceRequest(WifiP2pManager.Channel, WifiP2pServiceRequest, WifiP2pManager.ActionListener)

 The function call immediately returns after sending a request to remove service
 discovery request to the framework. The application is notified of a success or failure to
 add service through listener callbacks onSuccess() or
 onFailure(int).

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          req
          is the service discovery request.

          listener
          for callbacks on success or failure. Can be null.

        public

        void

      requestConnectionInfo
      (WifiP2pManager.Channel c, WifiP2pManager.ConnectionInfoListener listener)

  Added in API level 14

Request device connection info.

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          listener
          for callback when connection info is available. Can be null.

        public

        void

      requestGroupInfo
      (WifiP2pManager.Channel c, WifiP2pManager.GroupInfoListener listener)

  Added in API level 14

Request p2p group info.

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          listener
          for callback when group info is available. Can be null.

        public

        void

      requestPeers
      (WifiP2pManager.Channel c, WifiP2pManager.PeerListListener listener)

  Added in API level 14

Request the current list of peers.

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          listener
          for callback when peer list is available. Can be null.

        public

        void

      setDnsSdResponseListeners
      (WifiP2pManager.Channel c, WifiP2pManager.DnsSdServiceResponseListener servListener, WifiP2pManager.DnsSdTxtRecordListener txtListener)

  Added in API level 16

Register a callback to be invoked on receiving Bonjour service discovery
 response.

 see discoverServices(WifiP2pManager.Channel, WifiP2pManager.ActionListener) for the detail.

Parameters

          servListener
          is for listening to a Bonjour service response

          txtListener
          is for listening to a Bonjour TXT record response

        public

        void

      setServiceResponseListener
      (WifiP2pManager.Channel c, WifiP2pManager.ServiceResponseListener listener)

  Added in API level 16

Register a callback to be invoked on receiving service discovery response.
 Used only for vendor specific protocol right now. For Bonjour or Upnp, use
 setDnsSdResponseListeners(WifiP2pManager.Channel, WifiP2pManager.DnsSdServiceResponseListener, WifiP2pManager.DnsSdTxtRecordListener) or setUpnpServiceResponseListener(WifiP2pManager.Channel, WifiP2pManager.UpnpServiceResponseListener)
 respectively.

 see discoverServices(WifiP2pManager.Channel, WifiP2pManager.ActionListener) for the detail.

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          listener
          for callbacks on receiving service discovery response.

        public

        void

      setUpnpServiceResponseListener
      (WifiP2pManager.Channel c, WifiP2pManager.UpnpServiceResponseListener listener)

  Added in API level 16

Register a callback to be invoked on receiving upnp service discovery
 response.

 see discoverServices(WifiP2pManager.Channel, WifiP2pManager.ActionListener) for the detail.

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          listener
          for callbacks on receiving service discovery response.

        public

        void

      stopPeerDiscovery
      (WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener)

  Added in API level 16

Stop an ongoing peer discovery

 The function call immediately returns after sending a stop request
 to the framework. The application is notified of a success or failure to initiate
 stop through listener callbacks onSuccess() or
 onFailure(int).

Parameters

          c
          is the channel created at initialize(Context, Looper, WifiP2pManager.ChannelListener)

          listener
          for callbacks on success or failure. Can be null.

  Except as noted, this content is licensed under Apache 2.0.
  For details and restrictions, see the
  Content License.

    Android 4.4 r1 —

    About Android  |
    Legal  |
    Support