Chrome打包应用中的Google

Chrome打包应用中的Google

本文介绍了Chrome打包应用中的Google Drive Realtime API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何在中使用 Google云端硬盘实时API href ="https://developer.chrome.com/apps/sandboxingEval" rel ="nofollow"> Chrome打包应用?

Has anyone figured out how to use the Google Drive Realtime API in a Chrome Packaged App?

在沙盒iframe中加载gapi会导致:

Loading gapi in a sandboxed iframe results in:

未捕获的TypeError:无法读取未定义cb = gapi.loaded_0:6的属性'prototype'

Uncaught TypeError: Cannot read property 'prototype' of undefined cb=gapi.loaded_0:6

gapi.load("auth:client,drive-realtime,drive-share", function(){...});

请在以下位置查看我的示例存储库: https://github.com/damondouglas/sandbox -cpa-drive-rt

Please see my example repo at: https://github.com/damondouglas/sandbox-cpa-drive-rt

推荐答案

Damon-我以您在GitHub上发布的示例为例,将其更改为使用工作正常的webview.我认为您出于人为的原因而限制自己不使用它.在不使用Webview的情况下,仍然有可能以另一种方式解决此问题,但是经过大量的研究和反复试验后,我仍然没有找到更好的选择.

Damon - I took the example you posted on GitHub and changed it to use a webview which works fine. I think you are restricting yourself to not using one for artificial reasons. It may still be possible to solve this issue another way without using a webview, but after a good amount of research and trial and error I have not found a better option.

更新后的代码无需使用外部网站即可使用webview分区访问本地应用程序文件,因此该应用程序的所有资源都与该应用程序捆绑在一起,除了实时API之外没有任何外部引用.

The updated code uses webview partitions to access your local app files without using an external website, so all of the app's resources are bundled with the app with no external references other than to the realtime APIs.

https://驱动器. google.com/file/d/0B1es-bMybSeSVWozSkJ6OFd5YTQ/edit?usp=sharing

这篇关于Chrome打包应用中的Google Drive Realtime API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 02:14