How to connect Chrome packaged application with Google Drive API

I’m working on a Chrome packaged application and want to connect it with Google Drive for file synchronization. My goal is to create a standalone packaged app that can automatically sync user files to their Google Drive account without needing any external extensions or hosted components.

The main challenge I’m facing is with the file opening workflow. When users try to open files directly from the Google Drive web interface, I’m not sure if it’s possible to configure Google Drive to launch my packaged application instead of opening files in the browser. Is this type of integration supported for packaged Chrome apps, or are there specific limitations I should be aware of?

I want to avoid creating a hosted app solution and keep everything contained within the packaged app itself. What would be the best approach to handle this file opening scenario?

I’ve built something similar and encountered the same limitations. Unfortunately, Chrome packaged apps cannot integrate with Google Drive’s native file handlers. Instead, I opted for a drag-and-drop approach, allowing users to drop files directly into my app, which then syncs with Drive in the background. The Drive API is efficient once you navigate through OAuth2 authentication. Make sure to use the chrome.identity API for authentication in your packaged app; it’s the only reliable method. Additionally, consider including a sync status indicator to inform users about their file operations. The API also supports delta sync, preventing excessive server requests. While it may not provide the desired seamless experience, this solution successfully conforms to the constraints of packaged applications.

had this same prob last year. chrome packaged apps cant register as drive handlers - its just not supported. I switched to using the picker api inside the app instead. works well once ppl figure it out. just make sure u handle oauth correctly with chrome.identity or u’ll get bizarre auth errors.

You’re facing some limitations with Chrome packaged apps and their integration with Google Drive. Unfortunately, the workflow you envision for opening files isn’t possible, as packaged apps cannot register as handlers for Google’s ‘Open with’ feature, unlike web apps. I encountered a similar challenge when developing a document editor as a packaged app; Drive’s file picker is restricted to web applications only. A potential workaround is to implement the Google Drive API’s file picker directly within your application, requiring users to open files from inside your app rather than through Drive. As for syncing, you can leverage the Drive API with OAuth2 authentication from your packaged app. This API allows for smooth operations regarding file uploads, downloads, and monitoring changes. However, achieving the seamless ‘open with’ functionality would necessitate either a web app component or a Chrome extension bridge, which may not align with your goal of maintaining a standalone application.