Show Sidebar

EnableLanBroadcast & Example

Below is an example of how to get EnableLanBroadcast to work between two Android devices for the purpose of auto-connection between a Client and a Server.

The issue I was having was that I was trying to call EnableLanBroadcast and SetHostInfo from inside my Menu code. I believe this was too early.

What I needed to do was put it inside the BoltStarted() callback method on my ClientCallbacks and ServerCallbacks script.

I also had to change my android manifest file to add:

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE">

Note You will also want to test using two different devices as you cannot test this by running both the Client and the Server on the same machine.

Here is the simple LAN Menu code for auto-connecting:

Here is in my ServerCallbacks script:

Here is in my ClientCallbacks script:

 To Document Top