Inter-app communications

There is some API documentation on this but not enough.

http://www.defold.com/ref/iac/

If I understand this right it’s mostly meant for deep linking. Can more examples be posted for this? How to send messages? How to open other apps? Or maybe I’m misunderstanding and this is for opening apps from web-sites? I’ve not looked into IAC much before today.

https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Inter-AppCommunication/Inter-AppCommunication.html

Correct, this is for deep-linking and for passing data to an app when it’s launched which is useful for install attribution and things like that.

You open another app like this:

<a href="candycrushsaga://some_data">Crush some candy!</a>

And from within a running Defold app you’d simply use sys.open_url("candycrushsaga://some_data")

Where candycrushsaga on Android is set up as an intent-filter in the Android Manifest and as CFBundleURLSchemes in Info.plist on iOS.

1 Like

Could you post that as plain text somewhere? I think the forum software consumed your example.

Ah, sorry, have a look again.

1 Like

Thank you! Off to do some tests.

Instead of doing a directly link like your example I think it would probably be a good idea to first detect if the user is on a for example iOS device if possible, and then do something like one of the examples here:

I need to test more and see what works well enough.

I’m working on chapter for this in book at the moment, and am noticing that it seems the Android manifest file is already ready to go for IAC, but that the Info.plist file needs some small changes?

What it comes with by default:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>

        </array>
    </dict>
</array>

What it seems to need to be:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>com.yourcompany.yourapp</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>yourappname</string>
        </array>
    </dict>

So then

sys.open_url("yourappname://some_data")

Would work based on this.

I’m not sure if CFBundleURLName is required but I saw it elsewhere, and it doesn’t seem to have to match your app. I’m testing this soon. Does it look right? Could you check other apps that use IAC for iOS and see exactly what the Info.plist has for this section?

Testing these for Android and iOS myself soon.

The Info.plist could be populated with a value that can be set in the game.project file later maybe?

CFBundleURLName shouldn’t be needed as far as I can tell.

1 Like