I'm looking for a slick way to share data from one app user to another via email, I just need to be able to import a text file from an email, either with the data as an attachment or with a text string as a URI but I can't find anything to read it without user interaction i.e. saving the file and then manually loading it into the app.
I have searched the forums and help but I cant identify anything that will do it.
OK, what about if the data was built into a URI, a link in an email, is it possible to get an app to start in response to clicking on it, and then capturing the URI which would include the data required?
From my limited knowledge and investigations, I think this would require an entry in the manifest.xml, could this work?
You can start any installed application with intents (or PackageManager). However you will not be able to get a result from the mail client application.
and clicking on the link could then start myapp. If the full URI is then accessible to myapp, I would have my data.
It would then be a question of how an app can be started by clicking on the link.
Android would have to know that myapp:// relates to myapp and needs to start it.
I'm sorry to labour this point, but it is an important part of the app I am working on, I would like the process of transferring and importing data to be as transparent as possible to the user.
I haven't tried to start an application from a mail. So I don't know if it will work. Even if it works I don't think that you will be able to pass any information in the URI.
I guess that the devices are not connected in the same local network, right?
Can you use some online resource that will store the shared data?
The app will be for general release, so users could be anywhere. And if it proves popular, there could be a lot of traffic.
I will investigate further and experiment with it a bit, but I think the first question would be is it possible to change the manifest.xml once it's generated without upsetting B4A?
There is no problem with changing the manifest file. Though I don't see how it will help here.
After changing the file set it to be a read-only file. Otherwise the file will be overwritten.
Why not just put the Data on the web somewhere and then send a E-mail that the data is ready, start the app and it automaticly goes and gets the data. Unless you readly need the data in the email
When the app is out in the wild, it won't be under my control. A user will be able to share data with any other user, so it needs to be self contained and easy to use.
I've spent a few hours investigating this and have come to the conclusion that it's not going to be a quick fix. I need to learn far more about Android and probably a bit of Java as well, so I have gone halfway to meeting my requirements. The file is sent as an email attachment which the user then saves to the root of the SDcard.
When restarting the app, or selecing a menu option the import will be completed.
It's not perfect, but will have to do for now. I'll come back to it when I have more time.
Updating the tread: can now Google Drive be used to programmatically share application database ?
I mean - can Drive (or other cloud storage) be used as a file server for application ? https://developers.google.com/drive/about_auth
Yes. I'm not really familiar with Google Drive (yet). You need to get the file public link and then you can download it with HttpUtils.
According to this link: Displaying files (e.g. images) stored in Google Drive on a website - Stack Overflow the link will only be available to a limited time. If this is true then it will be better to use DropBox.