View unanswered posts | View active topics



Reply to topic  [ 1 post ] 
Improving AS3 AIR Mobile template 
Author Message
Member

Joined: Tue Jul 15, 2008 3:36 am
Posts: 170
Reply with quote
Hi here I want to share several changes that I did to the AS3 AIR Mobile template to make it more automatic, since changing the batch file between laptops and configuration is a bit tedious for me, and since I woke up early this morning and had nothing to do :lol:

Removing the air. Prefix
Since I only target captive runtime, and from what I gather, the prefix is used to detect if the user need to install AIR shared runtime or not. I see no reason/use of automatically adding "air." in front of my package name. And somehow it feels like being lied to by your tool :p.

Edit SetupApplication.bat and add this line under :user_configuration
Code:
:: Android packaging
set AIR_NOANDROIDFLAIR=true

Please pay attention to the value, it's must be "true" and not "TRUE", I think Adobe's tool only accept "true" as valid and reject everything else, idk.

Moving on, since our package name/app id is now no longer "air." + your_actual_app_id, we have to edit one more file. Edit Run.bat and add/modify these lines under :android-package just before "exit"
Code:
if %AIR_NOANDROIDFLAIR% == true (
   adb shell am start -n %APP_ID%/.AppEntry
) ELSE (
   adb shell am start -n air.%APP_ID%/.AppEntry
)


Automatic DEBUG_IP
Since I use multiple machine (at home, at work) and there is also possibility of other people working on the same project, plus I like my version control clean. I just set the DEBUG_IP to my current IP. This only tested on a machine with one IP address, I haven't tested it with machine with complex IP scheme (like using VirtualBox, multiple network interface, etc).

Edit SetupApplication.bat and add this line under :user_configuration and change
Code:
set DEBUG_IP=

to
Code:
for /f "tokens=2 delims=:" %%A in ('ipconfig ^| findstr /L /C:"IPv4 Address"') do set DEBUG_IP=%%A
set DEBUG_IP=%DEBUG_IP: =%


Set APP_ID to read from Application.xml instead of manually doing it by hand
Yes, I hate doing it manually.

Edit SetupApplication.bat and add this line under :user_configuration and change
Code:
set APP_ID=your.app.id

to
Code:
for /f "tokens=3 delims=<>" %%a in ('findstr /C:"<id>" application.xml') do set APP_ID=%%a
set APP_ID=%APP_ID: =%

This should read the application.xml <id>your.app.id</id>, pull "your.app.id" and assign it to APP_ID.

Hope this help, I know there are few constraints in using this, like

  • The IP Address only works on Windows 7, on XP I think you should change "IPv4 Address" to "IP Address"
  • The AIR_NOANDROIDFLAIR is, AFAIK, not official, I found it on SO, and they said Adobe's engineer confirm that it existed. I tested it and it works, so there.
  • Obviously this only works if your project structure is "as-is".
  • etc

So please be careful if you want to use it :)
Thanks.


Fri Jun 28, 2013 3:14 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.