Universal Remote Controller WiFi

时间:2018-09-18 20:08:29

标签: android kotlin android-wifi remote-control

I really dont know where to start, search for resources to study upon building a remote tv controller (WiFi) not IR

What actually try-ed was Search for Wifi P2P and connect to TV- but the TV is not discover-able in the P2P devices list.

  val receiver = WifiDirectBroadCastReceiver(mManager, mChannel, this)
    registerReceiver(receiver, intentFilter)

    mManager.discoverPeers(mChannel, object : WifiP2pManager.ActionListener {
        override fun onSuccess() {
            Toast.makeText(this@MainActivity, "Success", Toast.LENGTH_SHORT).show()
            Log.d("DiscoverPeers", "onSuccess: ")

        }

        override fun onFailure(reason: Int) {
            Log.d("DiscoverPeers", "Failed: reason -> $reason")
        }
    })

And the Receiver

    override fun onReceive(context: Context, intent: Intent) {
            when (intent.action) {

        WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION -> {
        wifiManager.requestPeers(channel, peerListListener)
        }
       ...

0 个答案:

没有答案