Any idea how to exchange data between users

Hi 

I have an App (drawing) and I can save drawing data onto the documents directory and able to retrieve data just fine. But I like to send this data to another user (of the same app). 

I have used social plugin whatsapp (and similar social like instagram…etc) but that can only take picture. I haven’t tried email yet but I would think email would be able to do an attachment. 

My question is not entirely the sending but also retrieving at the other user’s end.

I have looked on the net but found no answer except for maybe creating my own server code and perform the exchange of data like using mongodb (to store data and then allow the other user to retrieve them). But this method may not be practical since users may not want to share their own drawing data publicly.

email approach seems best but can corona retrieve data from a specific email?

I am a bit stump at the moment. Any ideas appreciated.

Sincerely

TH

iOS or Android?

iOS can send attachments via email that when clicked will open the receiver’s app and pass the data to your app.

Android has something like this too, but I don’t know how to do it (of if it can be done) on Android.

** UPDATE ** There is a plugin for this.  See post by xnailbender further down.

Thanks for the advice. I am using Android. 

I still don’t know if Corona can read from email. May have to use the db approach.

**UPDATE**   This post is wrong.  It seems there is a plugin to a support this feature.

Last I checked, there is no way for Corona running on Android to get data out of your email/attchment.  This ONLY works on iOS.

Thank you sir, I guess I will have to explore the server side / db approach, which is not entirely bad. Just have to be a bit clever in designing the process. 

TH

I would definitely look at a server solution for this so you have total control over what you want to achieve.

Thank you sir for the advice

therefgames,

Thanks to CesarHernandez and his generous /awesome plugin “Android File and URI Manager” you can transfer files through email similar to openURL scheme in iOS.

I’ve got a  custom mime type and when the user selects “Preview” the attachment, my app launches or resumes, gets the attachment, saves it to system.DocumentsDirectory and then through the plugins callback your get when the file is saved, I process the attachment (json file) all seamlessly.

It’s quite slick.  I struggled for weeks trying to get this to work without the plugin and I had given up until I went back and saw Cesar had not only solved the problem, but shared his work with the plugin.  2 Thumbs^!

Hope this helps,

Nail

Hi XnailBender

Really Cool… I have decided to use server side code for my project but this tip is really COOL. I will create a new project even just to test it out. Thanks for the Tip.

Rgds

TH

Glad you got your server solution implemented, curious how you are going to link up users.  Present a list of available images or send them a link to download.

Anyways, for the android openURL  scheme I used the code block from the github example 1, button 4 and the assoiciated listener.

My file was a json file, not an image.

If you’ve already got your  url scheme for ios working, you probably already check for launchArgs and have a onSystemEvent listener.

grab the launchArgs.url there and the event.url from the event listener when event.type == “applicationOpen”

[lua]

–in build.settings

intentFilters =
        {

          {
                label = “Your Label Spaces OK”,
            

           --not sure which actions are needed, but this works
                actions = { “android.intent.action.VIEW”,
                   “android.intent.action.EDIT”,
                   “android.intent.action.GET_CONTENT”,
                },
                categories =
                {
                    “android.intent.category.DEFAULT”,
                    “android.intent.category.BROWSABLE”,
                    “android.intent.category.OPENABLE”,
                },
                 
                 data =
                 {   scheme=“file”,
                      
                     mimeType=“application/yourcustommimetype”,  --ex: abrtc
                },  
            },

       },

usesPermissions =
 {

–not sure which permissions are needed, but this works

“android.permission.INTERACT_ACROSS_USERS”,
            “android.permission.WRITE_EXTERNAL_STORAGE”,
            “android.permission.READ_EXTERNAL_STORAGE”,

},

[/lua]

This should save you some trial&error and google gleaning if you do a test project to experiment.

Hope this helps,

Nail

iOS or Android?

iOS can send attachments via email that when clicked will open the receiver’s app and pass the data to your app.

Android has something like this too, but I don’t know how to do it (of if it can be done) on Android.

** UPDATE ** There is a plugin for this.  See post by xnailbender further down.

Thanks for the advice. I am using Android. 

I still don’t know if Corona can read from email. May have to use the db approach.

**UPDATE**   This post is wrong.  It seems there is a plugin to a support this feature.

Last I checked, there is no way for Corona running on Android to get data out of your email/attchment.  This ONLY works on iOS.

Thank you sir, I guess I will have to explore the server side / db approach, which is not entirely bad. Just have to be a bit clever in designing the process. 

TH

I would definitely look at a server solution for this so you have total control over what you want to achieve.

Thank you sir for the advice

therefgames,

Thanks to CesarHernandez and his generous /awesome plugin “Android File and URI Manager” you can transfer files through email similar to openURL scheme in iOS.

I’ve got a  custom mime type and when the user selects “Preview” the attachment, my app launches or resumes, gets the attachment, saves it to system.DocumentsDirectory and then through the plugins callback your get when the file is saved, I process the attachment (json file) all seamlessly.

It’s quite slick.  I struggled for weeks trying to get this to work without the plugin and I had given up until I went back and saw Cesar had not only solved the problem, but shared his work with the plugin.  2 Thumbs^!

Hope this helps,

Nail

Hi XnailBender

Really Cool… I have decided to use server side code for my project but this tip is really COOL. I will create a new project even just to test it out. Thanks for the Tip.

Rgds

TH

Glad you got your server solution implemented, curious how you are going to link up users.  Present a list of available images or send them a link to download.

Anyways, for the android openURL  scheme I used the code block from the github example 1, button 4 and the assoiciated listener.

My file was a json file, not an image.

If you’ve already got your  url scheme for ios working, you probably already check for launchArgs and have a onSystemEvent listener.

grab the launchArgs.url there and the event.url from the event listener when event.type == “applicationOpen”

[lua]

–in build.settings

intentFilters =
        {

          {
                label = “Your Label Spaces OK”,
            

           --not sure which actions are needed, but this works
                actions = { “android.intent.action.VIEW”,
                   “android.intent.action.EDIT”,
                   “android.intent.action.GET_CONTENT”,
                },
                categories =
                {
                    “android.intent.category.DEFAULT”,
                    “android.intent.category.BROWSABLE”,
                    “android.intent.category.OPENABLE”,
                },
                 
                 data =
                 {   scheme=“file”,
                      
                     mimeType=“application/yourcustommimetype”,  --ex: abrtc
                },  
            },

       },

usesPermissions =
 {

–not sure which permissions are needed, but this works

“android.permission.INTERACT_ACROSS_USERS”,
            “android.permission.WRITE_EXTERNAL_STORAGE”,
            “android.permission.READ_EXTERNAL_STORAGE”,

},

[/lua]

This should save you some trial&error and google gleaning if you do a test project to experiment.

Hope this helps,

Nail