Reputation: 1659
One possible solution is using Custom URL:
I follow the following tutorial and then further explore for the communicate for the two AIR applications in IOS. - The first app uses Custom URI "fbMY_APP_ID" as described in your first step, which is alright to be called by Safari. - The second app uses URLRequest with the Custom URI to communicate with first app.
I get the error: "SecurityError: Error #2193: Security sandbox violation: navigateToURL: app:/secondApp.swf cannot access tfbMY_APP_ID://test".
Upvotes: 0
Views: 510
Reputation: 21
You can add a custom protocol from the application manifest file like this (you can add more than one protocol)
<iPhone>
...
<InfoAdditions>
<![CDATA[
...
<key>CFBundleURLSchemes</key>
<array>
<string>thisIsSomeCustomAppProtocol</string>
</array>
...
]]>
</InfoAdditions>
...
</iPhone>
and you call the custom protocol like this:
<a href="thisIsSomeCustomAppProtocol://SomeCustomDataString_goes_here&use_url_encoded_strings:">This will call the App with some parameters included (if need be)</a>
Or use navigateToURL(...) like this:
var _customURL_str:String = "thisIsSomeCustomAppProtocol://SomeCustomDataString_goes_here&use_url_encoded_strings";
var _isProtocolAvailable:Boolean= URLUtils.instance.canOpenUrl(_customURL_str);
//
if(_isProtocolAvailable)
{
navigateToURL(new URLRequest(_customURL_str));
}
To listen for the call and actualy process the data that's being passed, do this:
NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE,_invokeHandler);
The event handler would process the data like this:
private function onInvoke(e:InvokeEvent):void
{
//...
var _queryString:String = e.arguments[0] ? e.arguments[0] : "";
//
if(_queryString.length > 0){
//handle the incomming data string
}else{
//no extra data string was sent
}
//...
}
hope that helps
Cheers:
-Nick
Upvotes: 1
Reputation: 2614
According to security sandbox imposed by Adobe AIR, navigateURL is restricted to well-known protocols such as http:, https:, sms:, tel:, mailto:, file:, app:, app-storage:, vipaccess: and connectpro:. You may find more information via here and here.
One way to work around is to utilize an html page as intermediate, where the page would relay the calls.
Upvotes: 1