Adobe AIR - listing installed applications

2019-02-15 15:34发布

问题:

Is it possible to get list of installed AIR applications, optionally only by one vendor?

Or, is it possible to check, whether is one application (checked by name/some id/vendor) installed (this method would be preferred)

Thank you.

回答1:

You can do this:

        private function loadAIR():void
        {
            var loader:Loader = new Loader();
            var loaderContext:LoaderContext = new LoaderContext();
            loaderContext.applicationDomain = ApplicationDomain.currentDomain;
            loader.contentLoaderInfo.addEventListener(Event.INIT, onInit);
            loader.load(new URLRequest("http://airdownload.adobe.com/air/browserapi/air.swf"), loaderContext);
        }

        private function onInit(e:Event):void
        {
            var air:Object = e.target.content;
            try
            {
              air.getApplicationVersion("appID", "publisherID", versionDetectCallback);
            }
            catch (e:Error)
            {
              trace('air not installed');
            }
        }

        private function versionDetectCallback(version:String):void
        {
            if (version == null)
            {
                trace('app not installed');
            }
            else
            {
                trace('app version ' + version + ' installed');
            }
        }


回答2:

This is an interesting question. I don't think there are any places on the client's computer where Adobe is storing a list of AIR apps installed on the computer, but you may be able to find it via airdownload.

Another decent alternative would be to use Adobe AIR 2.0's Command Line Integration feature. With that you could write an OS-dependent, yet fairly simple, script (shell, ruby, python, etc.) that recursively checked some directories for .AIR files by name, and if they weren't found, your startup app could say "Sorry we haven't found these two apps: X and Y. Please either specify their location or download them here". And after they specified the install path, you could infer where they might have other AIR apps installed.

Or you could install a text file in their home directory with a list of the AIR apps you have installed and read that to figure out what steps you should take next. That would probably be easier.

Hope that helps, Lance



回答3:

If you know the appID and the publisherID, adobe.utils.ProductManager might have something magical for you... but productManager is such a poorly documented class that I'm going to guess that my suggestion is a dead-end. I used it once for something and as I recall, because of the package location, I didn't get any code insight and it was a very trial-and-error process.