Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Communication problem between air application from swf at browser

Participant ,
Dec 29, 2013 Dec 29, 2013

Hi,

I am trying to communicate adobe air native application from brwser using swf, I check for native application installed or not. If installed then launch and if not then install and launch.

I am facing problem when browser crashes and communication get lost with adobe air native application. And when user restart web browser and try to make local connection for communication with native application, some times it get failed. so, how to handle this state please help.

Thanks

Nitesh Kumar

TOPICS
ActionScript
793
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 30, 2013 Dec 30, 2013

Can you post some code snippits on how you're creating the local connection as well as how you clean up the connection when it's lost and reconnect? Any errors you receive would be helpful as well as knowing which errors you're actually handling.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 05, 2014 Jan 05, 2014

Hi sinious,

How could I clean up connection when browser is aborted or lost?

below you can find the code snippet to check for air application and connection

airSWFLoader = new Loader();

                              loaderContext = new LoaderContext();

                              loaderContext.applicationDomain = ApplicationDomain.currentDomain;

                              airSWFLoader.contentLoaderInfo.addEventListener(Event.INIT, onInit);

                              airSWFLoader.load(new URLRequest("http://airdownload.adobe.com/air/browserapi/air.swf"),loaderContext);

function onInit(e:Event):void 

                    {

                              airSWF = e.target.content; 

                              switch(airSWF.getStatus().toString())

                              {

                                        case "available" : AirLoaderStatus = 1;

                                        break;

                                        case "unavailable" : AirLoaderStatus = 2;

                                        break;

                                        case "installed" : AirLoaderStatus = 3;

                                        break;

                              }

                    }

private function getAppStatus():void

                    {

                              clearInterval(intervalIdentifier);

                              if(AirLoaderStatus == 0){intervalIdentifier = setInterval(getAppStatus,1000);return;}

                              m_launchInstallBtn.visible = true;

                              var statusInfo:String = airSWF.getStatus();

                              airSWF.getApplicationVersion(m_installerFileName, m_pubID, versionDetectCallback);

                    }

function versionDetectCallback(version:String):void

                    {

                              if (version == null)

                              {

                                        trace("Not Installed");

                                        // Take appropriate actions. For instance, present the user with

                                        // an option to install the application.

                              }

                              else

                              {

                                        m_isPluginsInstalled = true;

                                        // Take appropriate actions. For instance, enable the

                                        // user interface to launch the application.

                              }

                    }

private function onlickMouse(event:MouseEvent):void

                    {

                              m_text.text += "\nm_isPluginsInstalled:"+m_isPluginsInstalled+":::AirLoaderStatus:"+AirLoaderStatus;

                              trace("\nm_isPluginsInstalled:"+m_isPluginsInstalled+":::AirLoaderStatus:"+AirLoaderStatus);

                              switch(event.currentTarget)

                              {

                                        case m_launchInstallBtn:

                                                     if(AirLoaderStatus == 1)

                                                     {

       installAirsetup();

                                                    }

                                                  else

                                                  {

                                                            if(!m_isPluginsInstalled)

                                                            {

                                                                      airSWF.installApplication(m_url, m_runtimeVersion, m_argsToPass);

                                                                      airSWF.launchApplication(m_installerFileName, m_pubID, m_argsToPass);

                                                            }

                                                            else

                                                            {

                                                                      airSWF.launchApplication(m_installerFileName, m_pubID, m_argsToPass);

                                                            }

                                                  }

 

                                        break;

                              }

                    }

in the above code snippet I pass localConnection for send and recieve as an argument in m_argsToPass.

the connection names strarts with "_".

In the air application I I split the event arguments like given below

argsArray = event.arguments.toString().split(",");

and then try to establish connection.

Please suggest, how could I clean the connection on lost/ abort of browser, since then swf object embeded in browser also get lost.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 06, 2014 Jan 06, 2014
LATEST

I'm not sure if you can install and launch the application in the same block, you might need to wait some nominal amount of time before launching.

Aside that please show me an example of the app ID you're using. The variable naming convention just has me questioning it, m_installerFilename. When you launch, that should be an App ID.

You do mention that you initially make a connection. If this connection is not severed, is it reliable? Also if you can please post your local connection connecting/negotiating code.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines