Disable AIR Framework Autoupdate
Programmatically Disable AIR Framework Autoupdate from Air Application
In a previous post you can find how to enable/disable Adobe AIR Framework Autoupdate using the Adobe AIR Manager tool.

We had the problem that we wanted to disable Adobe Air Framework from our AIR Application but we never found a way to do this even if the Adobe AIR Manager tool is a air based file. But a few days ago without any doubt what it must be we found a file inside the “C:\Documents and Settings\[user]\Application Data\Adobe\AIR\” (win XP) named “updateDisabled”. After enabling the Adobe AIR Framework Autoupdate the file was erased right away.
Then we found the all the magic of setting Adobe AIR Framework Autoupdate value it the presence of a specific file inside a specific folder. Nothing more.. no registry, no encrypted settings files or else.
We took the time and created a simple AS3 class that you can use for Manually Enable/Disable AIR Framework Autoupdate from your Abobe AIR application.
You can download the class from here: SettingsManager.zip or just browse the class code:
package www.timeister.com // Online Timesheet Software
{
import flash.desktop.NativeApplication;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.filesystem.File;
import flash.filesystem.FileMode;
import flash.filesystem.FileStream;
import flash.system.Capabilities;
public class SettingsManager
{
private static const AIR_SUPPORT_DIRECTORY_WIN:String = "/../../Adobe/AIR";
private static const AIR_SUPPORT_DIRECTORY_MAC:String = "/../../../Application Support/Adobe/AIR";
private static const AIR_UPDATE_DISABLED_FILE:String = "updateDisabled";
/**
* Constructor for Settings Manager class
*/
public function SettingsManager()
{
}
/**
* Method called to get the Adobe Air Autoupdate disabled value
* @return a boolean value according to the disable state (true = disabled)
*/
public function isAirUpdateDisabled():Boolean
{
var _loc_1:* = getApplicationSupportDirectory();
if (_loc_1 == null)
{
return false;
}
_loc_1 = _loc_1.resolvePath(AIR_UPDATE_DISABLED_FILE);
return _loc_1.exists;
}
/**
* Method called to Disable air framework autoupdates
* @return a boolean value telling the success of them thod call
*/
public function disableUpdates() : Boolean
{
var fileStream:FileStream;
if (!isOSSupported())
{
return false;
}// end if
var file:* = getApplicationSupportDirectory();
if (file == null)
{
return false;
}// end if
file = file.resolvePath(AIR_UPDATE_DISABLED_FILE);
if (file.exists)
{
return true;
}// end if
try
{
fileStream = new FileStream();
fileStream.open(file, FileMode.WRITE);
fileStream.close();
}// end try
catch (error:Error)
{
return false;
}// end catch
return true;
}
/**
* Method called to enable air framework autoupdates
* @return a boolean value telling the success of them thod call
*/
public function enableAIRUpdates() : Boolean
{
if (!isOSSupported())
{
return false;
}
var file:* = getApplicationSupportDirectory();
if (file == null)
{
return false;
}
file = file.resolvePath(AIR_UPDATE_DISABLED_FILE);
if (file.exists)
{
try
{
file.deleteFile();
}
catch (error:Error)
{
return false;
}
}
return true;
}
/**
* Method calle to check if this is a supported os
* @return a boolean value telling if os is supported
*/
private function isOSSupported() : Boolean
{
var capOs:String = Capabilities.os;
if ((Capabilities.os.indexOf("Windows") > -1) || (Capabilities.os.indexOf("Mac") > -1))
{
return true;
}
return Capabilities.os.indexOf("Linux") > -1;
}
/**
* Method called to get the Adobe AIR support directory
* @return a file reffering to the Air support directory
*/
private function getApplicationSupportDirectory() : File
{
var _loc_1:File;
if (Capabilities.os.indexOf("Windows") > -1 || Capabilities.os.indexOf("Linux") > -1)
{
_loc_1 = new File(File.applicationStorageDirectory.nativePath + AIR_SUPPORT_DIRECTORY_WIN);
}
else if (Capabilities.os.indexOf("Mac") > -1)
{
_loc_1 = new File(File.applicationStorageDirectory.nativePath + AIR_SUPPORT_DIRECTORY_MAC);
}
else
{
return null;
}
return _loc_1;
}
}
}