如何通过WiFi直接连接将屏幕共享到另一台设备

use*_*862 15 android wifi-direct

我想通过使用WiFi直接连接开发AP以共享(SOURCE)屏幕到另一个(SINK)设备.

我通过Wifi direct API成功连接两台设备,但getPresentationDisplay()返回null.似乎SOURCE设备没有找到SINK设备导出的任何其他显示服务.API级别4.2.2是否支持它?或者我可以将显示服务注册到SOURCE的任何API?

//Get Media router service
mMediaRouter = (MediaRouter) getSystemService(Context.MEDIA_ROUTER_SERVICE);
MediaRouter.RouteInfo route = mMediaRouter.getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_VIDEO);
if (route != null) {
    Display presentationDisplay = route.getPresentationDisplay();
    if (presentationDisplay != null) {
        Presentation presentation = new DemoPresentation(this, presentationDisplay);
        Log.i("tracer", "presentation.show();");
        presentation.show();
    }
}
Run Code Online (Sandbox Code Playgroud)

小智 0

这取决于您尝试连接的设备。Android 默认情况下不充当 Miracast/无线显示接收器。
为了能够实现Android - Android无线显示共享,请参考Miracast Sink support for android - HowTo