android 辅助显示设备,Android-O在辅助显示器上启动
当我尝试启动活动意图时,Android-O中的新ActivityOptions setLaunchDisplayId(int launchDisplayId)函数似乎总是崩溃我的应用程序.
当我从我自己的应用程序启动活动时以及当我尝试启动其他应用程序(即Chrome Canary)时.
有谁知道这是新API的一般问题还是我遗漏了一些东西:
我的代码的一小部分如下:
options.setLaunchDisplayId(1);
startActivity(intent,options);
注意
我正在使用’模拟第二个屏幕’进行测试(@ 1080p,如果重要的话).
UPDATE
我试过ADB命令adb shell start com.chrome.canary –display 1,
我得到的消息是:
start: must be root
解决方法:
我通过新的API连接到第二个屏幕,下面是代码,但是还没有办法与它进行交互.
Bundle bdl;
MediaRouter mediaRouter = (MediaRouter) mContext.getSystemService(Context.MEDIA_ROUTER_SERVICE);
MediaRouter.RouteInfo route = mediaRouter.getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_VIDEO);
if (route != null) {
Display presentationDisplay = route.getPresentationDisplay();
bdl = ActivityOptions.makeClipRevealAnimation(mView, left, top, width, height).setLaunchBounds(rect).setLaunchDisplayId(presentationDisplay.getDisplayId()).toBundle();
Bundle optsBundle = true ? bdl : null;
Intent intent = new Intent(mContext, SecondaryActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent, optsBundle);
}
标签:android,user-interface,android-8-0-oreo,api,display
来源: https://codeday.me/bug/20190627/1307884.html