Authenticate from mobile apps and access file from desktop applications - android

We have a use case where user need to select their file on cloud storage, e.g. Google Drive and get the selected file downloaded from a desktop application whithout downloading the file to their mobile.
Is this possible? If yes, what is the possible security concern?

I ended up with getting the file ID from mobile apps, and send the file ID to my desktop application. My desktop application will build the direct link with the following format
https://drive.google.com/uc?export=download&id=FILE_ID
then begin the download with Process.Start(DIRECT_LINK). This should start the download process with system browser. The only fall back for this method is that there will be no download progress reported back.

Related

Flutter: Download file from server, edit in third party app, re-upload when edited

Not even sure if this is possible at all, but here's what I need to do (OK means I am able to do this)...
Download file using a REST service, save to device (iOS, Android) - OK, using Dio
Open file in default application (for example Word or similar) - OK, using open_file
The user alters the file some way - can't get this one to work, file is read-only
Returning to my App, I need to re-upload the file if it has been altered - should be easy when I solve 3 and it is possible to determine if the file has been updated since it was downloaded (checking file write date or similar)
Now, the reason the file is read-only I assume is because it is downloaded to my apps storage. Is it possible to downlad a file to a location where the third-party app has write access to said file? Is this stuff even possible on a mobile device? I am writing both the client app and the REST server.
An alternative, I guess, could be to have my server upload the file to Google Drive, OneDrive or similar and have the third party app open the file from there... The user is authenticated, so I guess I could pick up the authentication token (JWT) and use this communicating with OneDrive or similar.
Any ideas?

Caching server for Android or some thing similar

Our Android app will be used in a place without internet. We have one server with limited internet there.
Can user download the app from the server instead of google play, the way we can use ios cache server?
If we keep a copy of app in the server and install from it, how can we update the app with latest version?
Thanks.
You can host the apk file on the server and download it to the devices for installation. However, you first need to enable third party source installation for the devices.
Link how to here,
https://www.cnet.com/how-to/how-to-enable-third-party-app-installation-on-most-android-phones/
In terms of the update, you can always update the apk file anytime but you might need a separate system to notify the users/devices about the update. Probably by using SMS.

Is it possible to transfer an app from one device to another?

Apps like Xender, allow a user to share an app with another user, by directly transferring (and installing the app) on another users device. This is done device to device, and done without the target device downloading the app from google play.
I already know how to transfer a file from one device to another using wifi direct.
My question is - what file do you need to transfer, to transfer the app? Is it the apk ? Where is it located ?
You can find the APK of your installed app in /data/app in your internal storage .
Not in every case but most of the time when your are sending an APK you are sending the complete APP .
Also check this post maybe thats what you want. https://stackoverflow.com/a/11908293/7704356

How to transfer file from Linux to Android using Google Drive

ENVIRONMENT:
I have a system consisting of Android clients and Linux server. Files (jpeg images) are transferred from Android client to Linux server via Google drive OK.
The client uses Drive API to upload the file into the ServerUploads folder on Google Drive
Client informs the server of the file via GCM (Google Cloud Messaging)
ServiceAccount on Server reads the file via REST API
I have this transfer working well.
Later the server needs to send the file (jpeg) to other clients based on search criteria, location, the view area, etc. So I try to reverse the flow to transfer the jpeg file to clients.
Service Account on Linux server uploads the file to ClientDownload folder on Google Drive
The server notifies client(s) of the file via GCM
The client tries to download the file via Drive API but fails due to protection
The app and ServiceAccount are both associated with the application in the developer's console.
The email associated with the App and ServiceAccount are different domains. (This is not Google Apps for Work.)
PROBLEM:
Since the newer Android Drive API with Google Play Services only supports Drive.SCOPE_FILE the app does not have access to files created by Service Account on Linux.
Is it possible on the server using REST API to add/change ownership of the file so the client can read the file with Drive?SCOPE_FILE? My attempts on this path so far have failed. Trying to insert new ownership fails with a status saying it's not yet implemented. Updating permissions to provide the app with ownership reports insufficient permissions for this file. Trying to patch the permissions give similar failure message. However, I am new to this API and may be doing it wrong.
Is it possible to access the contents of the file using Android DownloadManager service? The best I have done with this path, trying multiple variations of links, is an HTML file which looks appropriate for browser parsing and display: not the contents of the jpeg file. Again, this is a new area for me and I may not be doing it right.
From my research, it appears I can do what I need to do by using the REST API on the Android client, but I really don't want to incur that overhead if there's another path.
At a high level, the documentation (as sparse as it is) implies what I want to do possible. Does anyone have experience with this data flow pattern? If so, what's the appropriate way for the client to read the file created by the Service Account on the Server?
Thanks in advance!
After a few more days of exploring various rabbit holes I was able to download the file using Android DownloadManger. The trick was composing the correct query parameters in the HTTP request URI:
https://drive.google.com/uc?export=download&id=[resourceId]
Also the google drive file resource security needs to be 'public' or 'anyone with link' for this to work.

Can a android app using dropbox sync API use the cache, filesystem, files of the locally installed dropbox official app?

I have integrated the dropbox sync api with my native android app. My question is regarding the offline usage of cache, filesystem and files from the official dropbox app.
Setup:-
Device is android phone
Official dropbox app is installed
API used is the sync API
Scenario 1
If my android device is in aeroplane mode and my app is also running in background as a service. A new file is added to the dropbox app. This new file cannot be synced to the dropbox server because there is no network connection. Although my service has registered DbxFileSystem.SyncStatusListener I do not get a callback. Is it because my app does not share the filesystem of the locally installed dropbox app and my app and the dropbox app are treated as two separate clients?
Scenario 2
A new file is uploaded to the dropbox server, and it is immediately downloaded on the locally installed dropbox app by marking it as favorite. Then I put the android device in aeroplane mode. Then I launch the app. On this newly added DbxFile I call the getReadStream(). I observe that the DbxFile is not cached and attempts to connect to the network. Does it mean that I cannot use the downloaded file present in the filesystem used by the official dropbox app installed locally?
If the answer is "No the cache, filesystem and files used by my app and the official dropbox app are different and we are two separate clients for the dropbox server" then what API should I be using to achieve the behavior I want?
No, there's no way to access the Dropbox app's file storage/cache.

Categories

Resources