Reputation: 301
I want to create the update mechanism of my Adobe Air-based Android app. In my special case with a private, very small app audience I use a direct distribution (without Google Play, via phisical installing on the users device) of the my application apk-file. But also I need to be able to install updates to it automatically (Let's say it will be a button 'Check updates' in my app UI). Can anybody help me with this task? How can I create this?
Now I have the idea: I try to download the file with my app (using loaders and write the file using the File api) to the user storage... Then I want to use any Air Native Extension to launch that file. Is there any already created ANE to do that?
Upvotes: 1
Views: 410
Reputation: 2547
In my case for create auto update mechanism, I got local version number from app.xml and latest number from server. Here is my settings.
app.xml
...
<name>mysomeapp</name>
<!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.
Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
An updated version of application must have a versionNumber value higher than the previous version. Required for namespace >= 2.5 . -->
<versionNumber>1.0.1</versionNumber>
...
actionscript
private var appVersion: String;
public function init():void
{
// Get local versionnumber from app.xml
var appDescriptor:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = appDescriptor.namespace();
appVersion = appDescriptor.ns::versionNumber; // In this case, it returns "1.0.1".
// Get latest versionnumber from server
var httpservice: HTTPService = new HTTPService();
httpservice.url = "http://myserver/foobar/version";
httpservice.method = URLRequestMethod.GET;
httpservice.addEventListener(ResultEvent.RESULT, checkVersionResult);
httpservice.send();
}
public function checkVersionResult(e: ResultEvent): void
{
// Compare latest number with local number.
if (e.result != appVersion)
{
// If the local version is not latest, download latest app from server.
navigateToURL(new URLRequest("http://myserver/foobar/androidAppDownload"));
}
}
Upvotes: 0