distriqt / ANE-Message

Send messages from AIR using email and SMS
https://airnativeextensions.com/extension/com.distriqt.Message
0 stars 0 forks source link

Handling attachments #39

Closed adamski68 closed 6 years ago

adamski68 commented 6 years ago

Having resolved the ane recognition, I am now back to the original purpose.. which is to be able to send an attachment. I am a bit confused by what you said earlier - that iOS will not allow file access between apps and the example https://github.com/distriqt/ANE-Message/blob/master/example/starling/src/com/distriqt/test/message/MessageTests.as

I have 2 arrays, which I combine into one String with a carriage return in between the strings, In that way I can create a text file that is used as data for a mailmerge.

I need to be able to attach that created file to an email, but it seems that I need to use 2 different methods for Android and iOS? In Android I can save the file in a given location and then use the MessageAttachment statement to find the txt file and attach it to the email. correct?

In iOS I need to pass the array contents via the messagesendwithoptions statement, but whatever I try in the new MessageAttachment does not seem to work.

Thanks.

marchbold commented 6 years ago

The method is the same for both iOS and Android.

You use the sendMailWithOptions function and pass an Array of MessageAttachment objects. These just contain the native path to the file and the mimeType.

The only condition is that on Android the file path must be outside the applicationDirectory eg applicationStorageDirectory.

I'll finalise the documentation for you next week. Apologies I've been meaning to put this up for a while.

adamski68 commented 6 years ago

Thanks.

It is humming along nicely on android, but exactly the same code does not run on the button press on iOS. Have tried iOS 9 and 11.

Both have mail set up.

On Sun, 2 Sep 2018, 01:33 Michael, notifications@github.com wrote:

The method is the same for both iOS and Android.

You use the sendMailWithOptions function and pass an Array of MessageAttachment objects. These just contain the native path to the file and the mimeType.

The only condition is that on Android the file path must be outside the applicationDirectory eg applicationStorageDirectory.

I'll finalise the documentation for you next week. Apologies I've been meaning to put this up for a while.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/distriqt/ANE-Message/issues/39#issuecomment-417896639, or mute the thread https://github.com/notifications/unsubscribe-auth/Ahq3jRIbjwkhbJYZlM9hDPM1bM-wPt77ks5uWydFgaJpZM4WWIz5 .

adamski68 commented 6 years ago

Found it.

There was a space at the end of the key id…. Android is not fussed about it, but iOS is.

Space removed and it all seems to be working..

Regards,

From: Michael notifications@github.com Sent: 02 September 2018 01:33 To: distriqt/ANE-Message ANE-Message@noreply.github.com Cc: adamski68 adent739@googlemail.com; Author author@noreply.github.com Subject: Re: [distriqt/ANE-Message] Handling attachments (#39)

The method is the same for both iOS and Android.

You use the sendMailWithOptions function and pass an Array of MessageAttachment objects. These just contain the native path to the file and the mimeType.

The only condition is that on Android the file path must be outside the applicationDirectory eg applicationStorageDirectory.

I'll finalise the documentation for you next week. Apologies I've been meaning to put this up for a while.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/distriqt/ANE-Message/issues/39#issuecomment-417896639 , or mute the thread https://github.com/notifications/unsubscribe-auth/Ahq3jRIbjwkhbJYZlM9hDPM1bM-wPt77ks5uWydFgaJpZM4WWIz5 . https://github.com/notifications/beacon/Ahq3jWHMATlFNQuIgDAQQgBpom27szh8ks5uWydFgaJpZM4WWIz5.gif