Search code examples
androidactionscript-3airandroid-activity

Adobe AIR on Android communicating with native Android activity


I am working on an Adobe AIR app that will run on Android devices. The current issue I am facing is that I have received a jar file that contains an Android Activity that launches the camera, recognizes an image, and returns an id code back to the application letting the developer know which image was recognized. Thus, I need to launch the Activity from the AIR app and then return to the AIR app with the id code accessible. Is this possible?

I have read several answers regarding communicating with an AIR app via Android, but I haven't found any for communicating with an Activity via an AIR app.

Thanks so much!


Solution

  • You can start an intent on Android with navigateToURL(), details are described here:

    Launching intents

    For the data return, your AIR app can register a custom URI scheme which the native app can use to talk back to your app:

    Custom URI scheme

    Alternatively, you can use (or maybe find it somewhere) an ANE that uses startActivityForResult() native Android API to achieve two-way communication in a single call. AIR doesn't support that by itself, I believe.