提示共享用户安装应用

时间:2014-03-29 18:25:31

标签: google-drive-api

我正在使用Google Drive SDK,我制作了一个带共享功能的简单应用。遗憾的是,当文档与未安装我的应用程序的用户共享时,系统会提示他们显示以下消息:

You do not have StoryPad installed
This item was created with StoryPad, a Google Drive app you have not installed.

但是,他们没有看到安装此应用的链接或选项。有没有办法配置它,以便提示他们在这个屏幕上安装?我不希望用户不得不四处寻找安装此应用程序的方法,因为他们会离开。

以下是它的外观截图: enter image description here

1 个答案:

答案 0 :(得分:0)

查看Google Drive SDK文档,在error handling section中,您似乎捕获了错误:

 `403: The authenticated user has not installed the app with client id {clientId}
 The user has not installed the requesting app, or has uninstalled it.`

记录的建议行动是:

 Direct the user to the Chrome Web Store to install the app.

您没有列出您正在使用的语言,因此JavaScript中的示例(上述引用页面中也列出了其他语言)可能是:

request.execute(function(resp) {
    if (!resp.error) {

      //Excellent, everything is working correctly! Proceed to show your file.

    } else {

      console.log('Error code: ' + resp.error.code);

      if (resp.error.reason == "appNotInstalled") {

        //Here is where you implement the action to inform the user where to download your app.
        alert("You need to install StoryBoard to view this file! Please proceed here: http://<link to your app>");

      }

      // More error information can be retrieved with resp.error.errors.
    }
});