Sharing data across apps

Hi,

Is anything in Corona to share data across different apps? Quickly looking the API does not seem to have anything for that. What I would like to achieve is to have same random user id in different apps for analytics. Any ideas are welcome.

Matias [import]uid: 46570 topic_id: 30808 reply_id: 330808[/import]

Apps are sandboxed and cannot share data files with other apps.

You’re best bet is to use the internet to setup a server to pass data between the two.
[import]uid: 19626 topic_id: 30808 reply_id: 123304[/import]

I’m pretty sure you can do that in native iOS code (and 100% sure you can do that in Android). I think the idea is to use the wildcard app id’s and then you can share keychain data… But probably that will not work in Corona… [import]uid: 46570 topic_id: 30808 reply_id: 123309[/import]

As mentioned above, iOS apps are Sandboxed, and protected from each other, but there are a few workarounds.

URL Schemes:
Url Schemes are naming conventions that allow you to launch apps from other apps, with data. This is how Facebook’s login flow works. You call Facebook’s URL Scheme with your App ID, and it calls fb://token=xxxxx&otherstuff=xxxxx, and then the Facebook SDK processes the incoming parameters. For you, this means you can do the same thing, check to see if you can call your other Applications, and call one requesting an ID, and the scheme to use to call your app back again. As soon as any of your apps launch, they check if they were launched via a Scheme, and if so gather their data and relaunch the previous app. The downside of this is you will have to quicklaunch another app to retrieve it, so it’s definitely not invisible. The “… with Friends” series by Zynga does this to get User accounts on first launch.

Public Documents:
This one requires some serious sneakery. One of the only public folders accessible by everyone is Photos/Videos. You can take an existing image(preferably one of your own), and encode secret information into it. I.e. take the least significant bit of the alpha channel and encode 1 bit at a time within the image. The change is imperceptible, but then any app can look at that image and decode it, if they know what to look for. Since Corona doesn’t have much in the way of image manipulation, and the user has full control on deleting/moving/renaming images, this is probably a bad idea (But still possible). Look up Spore/Monaco and Steaganography for a little more information on this trick.

Edit:
Wild Card App IDs are only allowed on iOS for Development and not Distribution, making any solution using Wild Cards unusable if you want to use the App Store. [import]uid: 134101 topic_id: 30808 reply_id: 123317[/import]

Heh,

Using steganography sounds fun from a geeky perspective. Maybe you could even have it as a business plan:

  1. Hide stuff in users photos
  2. “get caught”
  3. Talk to all reporters you can while the scandal is hot
  4. Profit from added exposure

I’m not sure if an URL-scheme would work with multiple apps (n > 2) since you would not know which of them are available. If you have all apps with separate scheme, you would need to know which are available to call. It’s possible as native, but probably not in Corona. If you have alls apps share same scheme then you can’t be sure the original app gets launched back. I.e. if app A starts B, you can’t tell if B calling same scheme will start A or C. Or what do you think? [import]uid: 46570 topic_id: 30808 reply_id: 123413[/import]

The trick to URLSchemes is that you can put any string contents after the :, meaning you just need to setup a basic protocol your apps will all expect.

It’s a bit trickier since Corona doesn’t seem to have CanOpenURL, but you can run through a list of URL’s until you receive the ‘App Entered Background’ event. Not done any tests (I’m using Enterprise, so I have native access), but you may need to do 1 check per frame.

<br>The scheme I would use would be<br>A calls: system.openURL(<b scheme>:CALLER=<a scheme>)<br>B then checks for launchURLs, and removes the first block (up to :).<br>B then splits on the = and checks what type of parameter it is (either an ID or a Caller)<br>Since B now has the Scheme to call A with, B then calls system.openURL(</a><a scheme>:ID=<guestid>)<br>A checks for launchURLs and performs similar string manipulation to extract the ID<br>A now has B's login credentials.<br>
Edit: Put in code block, since formatting was all screwy.

Edit2: I should clarify that A, B, and C would all have unique schemes. And each game would need to have an up to date list of schemes from your other games (or get it from a server). [import]uid: 134101 topic_id: 30808 reply_id: 123414[/import]

Apps are sandboxed and cannot share data files with other apps.

You’re best bet is to use the internet to setup a server to pass data between the two.
[import]uid: 19626 topic_id: 30808 reply_id: 123304[/import]

I’m pretty sure you can do that in native iOS code (and 100% sure you can do that in Android). I think the idea is to use the wildcard app id’s and then you can share keychain data… But probably that will not work in Corona… [import]uid: 46570 topic_id: 30808 reply_id: 123309[/import]

As mentioned above, iOS apps are Sandboxed, and protected from each other, but there are a few workarounds.

URL Schemes:
Url Schemes are naming conventions that allow you to launch apps from other apps, with data. This is how Facebook’s login flow works. You call Facebook’s URL Scheme with your App ID, and it calls fb://token=xxxxx&otherstuff=xxxxx, and then the Facebook SDK processes the incoming parameters. For you, this means you can do the same thing, check to see if you can call your other Applications, and call one requesting an ID, and the scheme to use to call your app back again. As soon as any of your apps launch, they check if they were launched via a Scheme, and if so gather their data and relaunch the previous app. The downside of this is you will have to quicklaunch another app to retrieve it, so it’s definitely not invisible. The “… with Friends” series by Zynga does this to get User accounts on first launch.

Public Documents:
This one requires some serious sneakery. One of the only public folders accessible by everyone is Photos/Videos. You can take an existing image(preferably one of your own), and encode secret information into it. I.e. take the least significant bit of the alpha channel and encode 1 bit at a time within the image. The change is imperceptible, but then any app can look at that image and decode it, if they know what to look for. Since Corona doesn’t have much in the way of image manipulation, and the user has full control on deleting/moving/renaming images, this is probably a bad idea (But still possible). Look up Spore/Monaco and Steaganography for a little more information on this trick.

Edit:
Wild Card App IDs are only allowed on iOS for Development and not Distribution, making any solution using Wild Cards unusable if you want to use the App Store. [import]uid: 134101 topic_id: 30808 reply_id: 123317[/import]

Heh,

Using steganography sounds fun from a geeky perspective. Maybe you could even have it as a business plan:

  1. Hide stuff in users photos
  2. “get caught”
  3. Talk to all reporters you can while the scandal is hot
  4. Profit from added exposure

I’m not sure if an URL-scheme would work with multiple apps (n > 2) since you would not know which of them are available. If you have all apps with separate scheme, you would need to know which are available to call. It’s possible as native, but probably not in Corona. If you have alls apps share same scheme then you can’t be sure the original app gets launched back. I.e. if app A starts B, you can’t tell if B calling same scheme will start A or C. Or what do you think? [import]uid: 46570 topic_id: 30808 reply_id: 123413[/import]

The trick to URLSchemes is that you can put any string contents after the :, meaning you just need to setup a basic protocol your apps will all expect.

It’s a bit trickier since Corona doesn’t seem to have CanOpenURL, but you can run through a list of URL’s until you receive the ‘App Entered Background’ event. Not done any tests (I’m using Enterprise, so I have native access), but you may need to do 1 check per frame.

<br>The scheme I would use would be<br>A calls: system.openURL(<b scheme>:CALLER=<a scheme>)<br>B then checks for launchURLs, and removes the first block (up to :).<br>B then splits on the = and checks what type of parameter it is (either an ID or a Caller)<br>Since B now has the Scheme to call A with, B then calls system.openURL(</a><a scheme>:ID=<guestid>)<br>A checks for launchURLs and performs similar string manipulation to extract the ID<br>A now has B's login credentials.<br>
Edit: Put in code block, since formatting was all screwy.

Edit2: I should clarify that A, B, and C would all have unique schemes. And each game would need to have an up to date list of schemes from your other games (or get it from a server). [import]uid: 134101 topic_id: 30808 reply_id: 123414[/import]