Store data into google drive's backup tab instead of drive folders - whatsapp

I need to implement same thing like whatsapp storing all chat history to google drive on clicking on backup button in app. And same restore it in new device as required.
I have look for below references for implementing this, but some how I was not able to do it successfully.
https://developer.android.com/guide/topics/data/backup.html
https://developer.android.com/guide/topics/data/data-storage.html
https://developer.android.com/guide/topics/data/data-storage.html#db
Will this data backup option will help in my requirements or I need to do something else?
I successfully developed the file upload to google drive folders, but i need that data in the backup tab of google drive with app name.
can any one guide me how I can implement this or provide me some references?
Thanks in advance..!

You may refer with this documentation. The Google Drive API includes a special hidden folder that your app can use to store application data.
Note: This feature now uses the alias appDataFolder in place of appdata and appfolder.
To be able to use your Application Data folder, request access to the following scope:
https://www.googleapis.com/auth/drive.appdata
For more information about scopes and how to request access to them, see Authorizing Your App with Google Drive.

Related

upload files to any user's google drive after they authenticate

I want to upload files from my server to my users's google drive storage, after they authenticate, the questions are:
Is it possible to do that?
Do I have to re-authenticate the user every time they like to upload a new file?
Could I embed the uploaded MP4 files in my website? (using the html video source as the file's download link of the user's google drive account)
do I need to re-authenticate the user if they just want to see the embedded videos some time later, in other words, is there anyway I could save some sort of a Token so they don't keep doing that.
Is it possible to do that?
Yes
Do I have to re-authenticate the user every time they like to upload a new file?
No, store a refresh token for the user and they wont need to authenticate each time.
Could I embed the uploaded MP4 files in my website? (using the html video source as the file's download link of the user's google drive account)
I wouldn't recommend it google drive isn't really designed for hosting of files in this manner that and people would need access to the file to download it anyway, its a big can of worms.
do I need to re-authenticate the user if they just want to see the embedded videos some time later, in other words, is there anyway I could save some sort of a Token so they don't keep doing that.
Yes as mentioned if the files are uploaded to your drive account you own them. You would need to share the files with anyone that you want to have access to them. You could set the files to public but thats not the best way to go about this.
Reference
Using OAuth 2.0 to Access Google APIs

Where to store PWA app data on OneDrive not to be accessible by user?

I want to write a PWA app (to run on Android and Windows 10) working with user's files and photos on OneDrive. I need to store some metadata and I prefer those to be inaccessible to the user.
What are my options?
OneDrive approot special folder is normal folder visible to the user.
I do not want to store the data locally on the device, as I want the app to be run on multiple devices.
I cannot use Windows 10 UWP roaming app data, as they would sync between Windows 10 devices, but not to Android devices.
I do not want to store the data at the PWA's backend, as it would need creating an extra user account. I want the user to log in to their MS Account to access their OneDrive, and to create another account for storing metadata. I prefer the app to be 100% client side.
Are there any other options I missed? I would prefer creating some hidden folder on OneDrive accessible by the app, but by the user. OneDrive does not seem to have such functionality, at least if I read it's API docs properly.
Depending on your exact use case you may want to check out Microsoft Graph:
https://developer.microsoft.com/en-us/graph
Microsoft Graph is an cross-device experiences platform and available for nearly all platforms. Within the Microsoft Graph you can use Activities to share metadata between different devices: https://github.com/microsoftgraph/microsoft-graph-docs/blob/master/api-reference/v1.0/resources/project_rome_overview.md
There is also an demo project on Github of an PWA with usage of the Microsoft Graph:
https://github.com/boyofgreen/MSGraphPWA

Download files from a specific user's drive with google drive api

Is there a way to download files from a specific google drive, by using the google drive api? Currently i can only read the drive of the google user logged in.
Inorder to access data owned by someone on Google drive you need their permission. You can't just access my files unless I let you. The most common method for this is oauth2 but you can also use a service account.
Now if I set a file to public you would be able to read it using an API key but I would have to give you the file id.

Full access Google Drive API

For Google Drive API, the drive.file scope seems to give only access to the files created by the app. Is there a scope for Google Drive that gives access to the entire drive? Thanks
You may refer with this documentation. Full access to all files in the user's Drive (https://www.googleapis.com/auth/drive) may be necessary for some apps. An app designed to sync files, for instance, needs this level of access to Drive. Apps with special needs related to listing or reorganizing files might need full scope.
Check the sample code in this GitHub page.
Try this scope :
Google Drive
This will bring Full permissive scope to access all of a user's files

Is there a way to create a Dropbox link that opens a file or a folder in the native app?

Basically, what I would like to do is to create a link from a web application that will open a Dropbox file from appropriate Dropbox native app. Google Drive for example allows you to re-format the unique URL for a file such as https://docs.google.com/blablabla which you can retrieve from their API, into googledrive://docs.google.com/blablabla and lets you open the file in Google Drive native app.
I have tried dropbox:// URLs with no success, and have not found any existing conversation on this despite running cross multiple conversations on the same subject for Google Drive or Evernote. Please let me know if it is possible to somehow generate this via API or based on the folder structure etc.
Thanks!