Does Google Drive Android API help my application to work in background? - google-drive-android-api

I have read Google Drive API documentation but I'm not able to understand the following:
Can files and folder be created and modified on drive in background of app?
My application needs working of drive in background.

For Files:
If you will check "Working with File Contents":
Lifecycle of a Drive file
The Drive Android API lets your app access files even if the device is offline. To support offline cases, the API implements a sync engine, which runs in the background to upstream and downstream changes as network access is available and to resolve conflicts.
Check this image from the document.
The lifecycle of a DriveFile object:
Perform an initial download request if the file is not yet synced to the local context but the user wants to open the file. The API handles this automatically when a file is requested.
Open the contents of a file. This creates a temporary duplicate of the file's binary stream which is only available to your application.
Read or modify the file contents, making changes to the temporary duplicate.
Commit or discard any file content changes that have been made.
If there are changes, the file contents are queued for upload to sync them back to the server.
Google API does support running in background. For folders there is no documentation regarding creating of folder can be done in background, but I think same implementation can be done.
I hope this helps.

Related

Sanboxed app, include files by reference?

So I have a sandboxed app, which allows users to drag and drop files from Finder onto a project window.
I would like to use these files from their existing location, ie by reference, rather than copy them to a project folder, as the user may have a large existing library of files.
While the app is running, these files are fully available for reading. (They are .mp4 and I can preview them in an AVPlayer view).
When I save the app's project, I include the NSURL of the files.
When the app restarts and re-opens the project later, the files are not available and Console shows deny(1) file-read-data - which means the file is not reaable. (Access denied).
Presumably this is because the files are out-side of the sandbox. Yet, they were readable when dropped onto the app. Looks to me like the app sees them as "user selected" when first dropped on, and so they are readable, but on the next session because they are loaded from NSCoder as NSURLs they are not considered user-selected and therefore become unaccessible!
My app currently has these entitlements:
com.apple.security.files.user-selected.read-only
com.apple.security.files.user-selected.read-write
Is there soemthing I need to do with entitlements etc to allow the re-loading of files later?
When the file is first dropped you need to create and save a security scoped bookmark which you can the use on a subsequent app launch to regain access to the file. Read Security-Scoped Bookmarks and Persistent Resource Access in Apple's App Sandbox in Depth.

Is it possible to create a shortcut to a file that is in Google Drive?

I have asked this question so that they can respond that it is possible to create a shortcut for a file that is in the cloud, this access will be created in the device memory, what is the purpose of this: My application has integrated a function to upload a file to the cloud and then run it from a system application like player, gallery, among others, but without having to download anything, but from an application that is installed Installed on the device (nothing external). Thank you very much.
You may want to check Create a shortcut to a file. As mentioned,
To create a shortcut instead of a file stored in Drive, use the files.create method of the API and make sure you set the MIME type application/vnd.google-apps.drive-sdk. Do not upload any content when creating the file.
However, for Google Drive Android API, you may want to check Creating Files for more information.

Uploading files to service account in Google Drive

We have a requirement where we should provide capability to upload files up to 100 GB size. Current flow which we have is to put the file from client location/local system to the application server. Then application server pushes the file to a service account in Google Drive server. I would like to know if there is a way to push the file from local system directly to service account in Google Drive. This would help us to not have to store such big files in application server. Please let me know. Also would like to know if we can actually have Drive installed in our local system to point to a service account. This way these big files can be put into the drive location and it will be synced to server in the background.
I would like to know if there is a way to push the file from local system directly to service account in Google Drive
The only way I know is for you to upload them. The Upload Files page in the Drive API documentation details this feature. In your case, you'll have to use uploadType=resumable due to the file size you'll upload.
Also would like to know if we can actually have Drive installed in our local system to point to a service account
Syncing ala-Dropbox might be a bit tricky, I haven't read anything in the Drive documentation that has this feature. Syncing to desktop is usually just a .glink shortcut that will open up a browser.

Monitoring if File is currently open Mac App

My app create a file on the FS and opens the file in other application(s). I want to monitor the file for changes which I already have in place, but I also want to know when the other application has closed the file. Is there some API that currently exists on mac, and it's an API that will not get my app rejected from the app store ?
I believe the thing you're looking for is in FSEvents (File System Events), specifically the FSEventStreamCreate function with the FSEventStreamEventFlag kFSEventStreamEventFlagItemModified.
As long as it's a file within the user's sandbox (or one that the user has given permission to use), I would think you should be okay for the app store.
More information can be found in this related question.

Can we create a war file for a play2.1.1 application offline?

I have tried creating war file for a play2.1.1 application following the instructions given in the github link - https://github.com/dlecan/play2-war-plugin/
However it fetches the plugins files from online repository and its been referenced in the play program. This method works only if the internet is connected.
Can i download the actual plugin file from this site and save it in my local system and generate a play war file offline?
Partially Yes. You need to go online only once to get all the dependencies downloaded. Once you are done, then you can work completely offline. Also I would like to mention this link: http://brainstep.blogspot.in/2013/10/how-to-install-play-2-war-bare-minimum.html
There is no official way for doing this, but if that aren't to much files, you can use Fiddler Web Debugger to look what files get downloaded, save them to your hard disk and then activate Fiddler's Auto responder. Everytime the Application requests the Files from the Server, Fiddler replies with the Files on your Hard disk.