Java Code Examples for

The following examples show how to use These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: nfcspy   Author: sinpolib   File:    License: GNU General Public License v3.0 5 votes vote down vote up
void init(Context ctx, ChannelListener lsn) {
	wifip2p = (WifiP2pManager) ctx.getSystemService(WIFI_P2P_SERVICE);

	channel = wifip2p.initialize(ctx, ctx.getMainLooper(), lsn);

	if (wifip2p != null && channel != null) {
		isWifiP2pEnabled = true;
		status = STA_P2P_INITED;
	} else {
		isWifiP2pEnabled = false;
		status = STA_P2P_UNINIT;
Example #2
Source Project: gilgamesh   Author: n8fr8   File:    License: GNU General Public License v3.0 5 votes vote down vote up
public void init (GilgaService service)
 mService = service;

     mWifiManager = (WifiP2pManager) mService.getSystemService(Context.WIFI_P2P_SERVICE);
     mWifiChannel = mWifiManager.initialize(mService, mService.getMainLooper(), new ChannelListener()

public void onChannelDisconnected() {
	Log.d(GilgaService.TAG,"wifi p2p disconnected");
     WifiP2pDnsSdServiceRequest serviceRequest = WifiP2pDnsSdServiceRequest.newInstance();
             new ActionListener() {
                 public void onSuccess() {
                     // Success!
 	            	Log.d(TAG,"SUCCESS: added service request wifi name service");


                 public void onFailure(int code) {
                     // Command failed.  Check for P2P_UNSUPPORTED, ERROR, or BUSY
                 	Log.d(TAG,"FAILURED: added service request wifi name service: " + code);