WindowManager: Failed to create the window. Cause: {"code":1300002}
20
我模拟官方给的launcher,想开发自己的launcher,在窗口创建时报了这个错误;虽然官方给了错误code,但是我想知道,该怎么处理呢,官方launcher也没做对应的处理呀?!!
createWindow(context: common.ServiceExtensionContext, name: string, windowType: number, loadContent: string,
isShow: boolean, callback?: Function) {
Log.showDebug(TAG, `prepare createWindow, path ${loadContent} windowType = ${windowType}`);
let config = {name: "deskWindow", windowType: windowType, ctx: context};
Window.createWindow(config, (err, win) => {
if (err.code) {
Log.showDebug(TAG, `Failed to create the window. Cause: ${JSON.stringify(err)}`);
return;
}
win.setBackgroundColor(StyleConstants.DEFAULT_SYSTEM_UI_COLOR, () => {
Log.showDebug(TAG, `then begin ${name} window loadContent in then!`);
if (name !== this.RECENT_WINDOW_NAME) {
void win.setLayoutFullScreen(true).then(() => {
Log.showDebug(TAG, `${name} setLayoutFullScreen`);
});
}
if (callback) {
callback(win);
}
Log.showDebug(TAG, `prepare showWindow, name ${name}`);
// there is a low probability that white flashes when no delay because of setBackgroundColor is asynchronous
setTimeout(() => {
isShow && this.showWindow(name);
}, StyleConstants.WINDOW_SHOW_DELAY)
})
});
} 1
浏览519 发布于2023-12-14 00:17上海
全部评论
最多点赞
最新发布
最早发布
写回答
所见即所得编辑器, editor1
工具栏
0/50000
新增插入模板功能
一键使用模板,快速填写内容,轻松发帖~
知道了
- 为了保障您的信息安全,请勿上传您的敏感个人信息(如您的密码等信息)和您的敏感资产信息(如关键源代码、签名私钥、调试安装包、业务日志等信息),且您需自行承担由此产生的信息泄露等安全风险。
- 如您发布的内容为转载内容,请注明内容来源。
我要提问题
了解社区公约,与您携手共创和谐专业的开发者社区。





































苏公安网备 32011402010933号