I have my application used by 4 users, all using the same device model on the same version of android. As part of the application a user can submit an order and generate an order acknowledgment email. During the creation of the email I have 2 users experiencing major issues and 2 users who have not experienced a problem in 12 months of use. The code structure is basically as follows.
Build string variable up some html content(a table containing rows with the order detail)
Check if 'acknowledgements' directory exists in the defaultexternal directory and create if not.
Use File.writestring to dump the string contents to a new file <xxxxxx>.html in above directory where xxxxxx is the ordernumber.
Then using Email library, add recipient, subject and body and attach above file and call StartActivity(email.getintent)
What I am seeing is that randomly on some orders, 2 of the 4 users are having to wait up to 1 hour for the email client to start up with email and it's attachment. I can only think that the problem is perhaps related to File.writestring not closing the file which results in the Email struggling to attach the file just created. Can anybody advise on the issue or potential cause if I'm barking up the wrong tree. Would there be any benefit in me using file.textwriter where I can actually code in a flush and close prior to calling the email intent, thus ensuring the file is definitely closed? I would have thought the file.writestring would have been taking care of this which is why I haven't tried my own suggestion as yet. I can't re-create the problem on my own tablet(same model as 4 users) and the 2 affected users are only experiencing this randomly but as this is a business based system that is used in front of clients it is vital that I resolve this issue or at least have an idea as to why the operating system is causing such a delay with a simple and very small email.
many thanks in advance.
Build string variable up some html content(a table containing rows with the order detail)
Check if 'acknowledgements' directory exists in the defaultexternal directory and create if not.
Use File.writestring to dump the string contents to a new file <xxxxxx>.html in above directory where xxxxxx is the ordernumber.
Then using Email library, add recipient, subject and body and attach above file and call StartActivity(email.getintent)
What I am seeing is that randomly on some orders, 2 of the 4 users are having to wait up to 1 hour for the email client to start up with email and it's attachment. I can only think that the problem is perhaps related to File.writestring not closing the file which results in the Email struggling to attach the file just created. Can anybody advise on the issue or potential cause if I'm barking up the wrong tree. Would there be any benefit in me using file.textwriter where I can actually code in a flush and close prior to calling the email intent, thus ensuring the file is definitely closed? I would have thought the file.writestring would have been taking care of this which is why I haven't tried my own suggestion as yet. I can't re-create the problem on my own tablet(same model as 4 users) and the 2 affected users are only experiencing this randomly but as this is a business based system that is used in front of clients it is vital that I resolve this issue or at least have an idea as to why the operating system is causing such a delay with a simple and very small email.
many thanks in advance.