1

I have created a realtime document on Google Drive. When I attempt to share this file with someone who doesn't have my app installed, the file shares successfully, but when they click the file it says "Sorry, no preview is available".

This realtime document is a shortcut file. How do I get it to prompt the person to authorize my app?

Eric Anderson
  • 3,692
  • 4
  • 31
  • 34
  • Hi Eric - I'm not sure how to solve your problem, but we take advantage of the fact that you can send an email with a custom message when sharing a document with people to redirect them to our app page. At that point we request the Drive.Install scope. I haven't investigated, but you may be able to use the Drive SDK integration from the Google APIs console to do what you're after (accessible from the left menu bar in the legacy version of the API console). https://code.google.com/apis/console/b/0/?noredirect#project::drive_sdk – Grant Watters Jun 24 '14 at 21:05
  • I've played with the Drive integration functions but none of those options provide the seamless experience I am looking for. Including special instructions or links in the share doesn't really solve the problem. Users may share a document independent of my application (i.e. the share options of the document in the Drive UI). This means they are the only one who types in the message. Relying on the user to instruct the receiver on what app they need to install to view the file isn't very reliable. – Eric Anderson Jun 24 '14 at 22:20

2 Answers2

0

I'm using the Realtime Playground as my example as I'm not sure of the specifics of your application.

App authorisation

When you created your application you visited the Google API Console and created a project with Drive API enabled. At some point you copied "Client ID" from the Google API Console into you application ID code.

In the realtime-playground case APP_ID is set in the javascript file rtpg.js (you might not be using JavaScript but there will be an equivalent step for other languages).

rtpg.APP_ID = '840867953062';

File creation

I believe that any drive realtime document/shortcut you created with your application will contain a reference to the creating application (mostly likely in the form of the client/application ID you obtained above).

File sharing

Once you can see your newly created Google Drive Realtime document/shortcut you can share this with somebody else using the normal Google Drive sharing methods. At this point they can see it but cannot do anything apparently useful with it. This is where I believe your application may differ from the realtime-playground example.

Integration with Chrome Web Store

On the GitHub repository for realtime-playground you'll notice a cws (Chrome Web Store) directory containing the stuff necessary to deploy the realtime-playground as Google Drive application in the Chrome Store including screenshots to be used. If you look at the manifest.json file you will see another reference to the client id:

"api_console_project_id" : "840867953062"

So if I share a realtime-playground file with somebody who doesn't have it installed, then clicking on the file in Google Drive will result in a "Connect app" popup which will try to locate the corresponding Chrome Web Store Drive app (using the common id as the key) and this will show something similar to what you might see if you found this application directly in the Chrome Web Store.

The manifest.json also contains:

"app" : { "launch" : { "web_url" : "https://realtimeplayground.appspot.com/" } }

which tells Google Drive what to do when the installed app is called.

So my guess is that your application doesn't work like this as you don't yet have public visibility of your app in the Chrome Web Store.

See also: Create a Chrome Web Store Listing

I hope this helps.

Mark McLaren
  • 11,470
  • 2
  • 48
  • 79
  • So sounds like once I get my app in the Chrome Web Store and have everything configured right the clunkiness will go away. Users will be prompted to either install my app or be given a list of apps that work and my app will be one of them. This is helpful. I'm going to play around with this for a bit. If it works out I'll come back and award the bounty. Thanks! – Eric Anderson Jun 26 '14 at 15:20
  • This sounds like Chrome-specific solution. Moreover, it is stupid to use the PlaygroundDemo as example because it does not provide any preview either. I see no cleverness in associating your file with chrome extension rather than with your app. It seems stupid to non-human. – Little Alien Jul 18 '16 at 08:19
0

That is fine. If you open your eyes, you will notice that Playground demo does not provide any preview either

enter image description here

Yet, you see, the associated app is available. You can click it and open-with works normally. Your app-created files operate similarly. They are associated with your app by default. You can open them by open with rather than by preview. Can you? No, you cannot. But that is another question.

Otherwise, I see no cleverness in associating your file with chrome extension rather than with your app.

How do I get it to prompt the person to authorize my app?

I recently had a similar question. Instead of linking your files with extension in chrome, pass the direct link, like http://your-app#fileId=..., as playground demonstrates to your shared fellow if open-with fails.

The preview seems to be another story.

Wait, Do you mean that I need to create a new fresh account to test how your file is unassociated with your app? How do you preview the files in your primary account? If you know how to preview you may answer my question, at least partially. But why do you associate authorization with preview?

Community
  • 1
  • 1
Little Alien
  • 1
  • 8
  • 22