In my iOS app, once a month I want to email or FTP a file automatically to myself… The file is in the app’s documents folder and I do not want the app’s User to have to anything to make it happen…
Any ideas on how I might be able to do this?
iOS has very simple methods for sending emails (FTP also, but more complex, as a server is required)… however Xojo does not currently (to my knowledge) expose those methods as part of the normal syntax, and it will required adding band-aid (I mean declares) to you code.
I have non Xojo code that emails files, but I’m NOT sure even it can do it invisibly (ie, without presenting a dialog to the user to confirm the email)
Dave thanks for your reply… Jason has a class that will send emails that I have used before but it requires user interaction… but I do not want the user to have to do anything.
You should always require user interaction before sending emails from their account (that’s what those declares do, and why it pops up the email view.)
To get data out without asking the user you could upload it to your server with a socket.
Tim… actually it is not from “their” account… It is my iPad and my account they are just using it… the iPad is actually being used in a kiosk situation… and I need to get the results of data those users are entering.
Then collect the data, and when you next take possesion of the iPad, activate the email to transmit the collected data
Okay you missed the point though.
Dave… except that the iPad is in a different country and I will only have access to it a few times a year… and I need the data more frequently than that.
You mentioned FTP, so you do have a server, right?
Use a HTTP gateway on the server to accept file uploads with a socket.
HTTPSocket works very well in Xojo iOS. My first app uses it to get to my web service and then download the fonts.
You can very well have the app send data on a regular basis to your own server that way.
It is far easier than email.
Thanks guys… I will explore that option…
Do you know the size of the file ?
You could send yourself an email using a transactional email service such as Mandrill by Mailchimp but it has a cost:
I can send you Xojo iOS classes to use Mandrill, create an email, add an attachment and send yourself the email.
This process is completely transparent to the user. I currently use it each time there’s an unhandled exception in the app.
By the way I would recommend to setup the frequency of the emails in a database, maybe the min and max file size of attachment too.
As it seems you don’t get access to the iPad very often, you could update the frequency in DB without even touching the iPad and not waiting for an App update.
Thanks for the suggestion… I decide to use an HTTP socket which sends the data to a php script I have on my server… and that is working just fine.