Android WifiManager.MulticastLock - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android WifiManager.MulticastLock class.

This code example shows how to use the following methods: isHeld, release
		multicastLock.acquire();
		return multicastLock;
	} 
 
	public static void releaseMulticastLock(final MulticastLock pMulticastLock) {
		if (pMulticastLock.isHeld()) {
			pMulticastLock.release();
		} 
	} 
 
	// =========================================================== 
	// Methods 
	// =========================================================== 
 
	// =========================================================== 
	// Inner and Anonymous Classes 
	// =========================================================== 
} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: acquire, setReferenceCounted
		InetAddress addr = InetAddress.getByAddress( byteaddr );
		Log.d( TAG, "startProbe : wifi address=" + addr.toString() );
 
		// start multicast lock 
		mLock = wifi.createMulticastLock( "mythtv_lock" );
		mLock.setReferenceCounted( true );
		mLock.acquire();
 
		zeroConf = JmDNS.create( addr, HOSTNAME );
		zeroConf.addServiceListener( MYTHTV_FRONTEND_TYPE, this );
 
		Log.v( TAG, "startProbe : exit" );
	} 
 
	/** 
	 * @throws IOException 
	 */ 
	private void stopProbe() throws IOException { 
		Log.v( TAG, "stopProbe : enter" );
 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: acquire, release, setReferenceCounted
        super.onCreate(savedInstanceState);
 
        try { 
            WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
            MulticastLock lock = wifi.createMulticastLock("wifi_multicast_lock");
            lock.setReferenceCounted(true);
            lock.acquire();
            NetworkDiscoverer.findPrinters(this);
            lock.release();
        } catch (DiscoveryException e) {
            new UIHelper(this).showErrorDialog(e.getMessage());
        } 
    } 
} 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: acquire, isHeld, release
		if (wifiMulticastLock == null) {
			QLog.e(getClass().getName(), "Could not obtain MulticastLock!");
			return; 
		} 
 
		wifiMulticastLock.acquire();
		if (isHeld()) { 
			QLog.i(getClass().getName(), "Acquired MulticastLock!");
		} else { 
			QLog.w(getClass().getName(), "Failed to acquire MulticastLock!");
		} 
	} 
 
	public void release() { 
		if (isHeld()) { 
			QLog.i(getClass().getName(), "Releasing MulticastLock!");
			wifiMulticastLock.release();
		} 
	} 
 

5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: isHeld, release
		super.onDestroy(); 
		if (channel != null) {
			running=false;
			channel.disconnect();
			channel.close();
			if (mcLock.isHeld()) {
				mcLock.release();
			} 
		} 
 
		textview.setText("activity destroyed");
		Toast.makeText(this, "activity destroyed", Toast.LENGTH_LONG).show();
 
	} 
 
	public void viewAccepted(View new_view) {
		// TODO Auto-generated method stub 
		System.out.println("received new view from " + new_view);
		view.setText("Received new view: " + new_view.getMembers().toString()
				+ "\n"); 
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android WifiManager.MulticastLock Questions & Answers:

See Code Examples for Android WifiManager.MulticastLock Methods: