How can I search for Miracast compatible devices (may be using WiFi Direct) in android?
I just got to know that DisplayManager and Presentation class in Android 4.2 help in presentation & miracast. But is there any way I can check if the other device is Miracast compatible / search Miracast sink?
Thanks
Smitha
android framework source codes shows how to search miracast sink devices.
basically using WiFi Direct devices search API, discoverPeers -> requestPeers -> isWifiDisplay & isPrimarySinkDeviceType
https://github.com/kensuke/How-to-Miracast-on-AOSP/wiki/wfd_scan
WifiP2pWfdInfo defined four device types,
http s://android.googlesource.com/platform/frameworks/base/+/master/wifi/java/android/net/wifi/p2p/WifiP2pWfdInfo.java
if you don't familiar with wifi direct, maybe my app is useful for using wifi direct api.
http s://github.com/kensuke/WiFiDirectTestApp
ADD: 2014/02/24 - parse toString output String for recognize Miracast devices Source or Sink
Wi-Fi Direct API requestPeers() callback to onPeersAvailable(), this method's parameter WifiP2pDeviceList has near by P2p devices that is a list of WifiP2pDevice instances, WifiP2pDevice has one device Wi-fi Direct information including Miracast information(wfd..) and device into can get uses WifiP2pDevice.toString() method.
Search "WFD DeviceInfo: XXX" String, XXX is a numerical value, masked "0x03" (see WifiP2pWfdInfo.java), after masked we get 0-3. That value defined SOURCE or SINK, see WifiP2pWfdInfo.java constants).
This very duty way can using on non rooted device, general app.
Sample of WifiP2pDevice.toString() returned value
"Device: ZTS1145
deviceAddress: 7a:e8:b6:f6:4d:74
primary type: 10-0050F204-5
secondary type: null
wps: 392
grpcapab: 0
devcapab: 33
status: 3
wfdInfo: WFD enabled: trueWFD DeviceInfo: 273
WFD CtrlPort: 7236
WFD MaxThroughput: 10"