accessing androidmanifest.xml variables

Monkey Targets Forums/Android/accessing androidmanifest.xml variables

pantson(Posted 2011) [#1]
Hi
Is it possible to access the following in the androidmanifest.xml file?
${APP_PACKAGE}
${APP_LABEL}
${SCREEN_ORIENTATION}

What would be nice is to access and set them from the monkey code.


therevills(Posted 2011) [#2]
Yeah it would be nice.

At the moment I've got a batch file which I run after I compile/clean the build folder which populates the CONFIG.txt and copies over my icons.


devolonter(Posted 2011) [#3]
Set of these variables from the Monkey code is impossible, because they all need to build Android template. But reading can be done through a wrapper module for the standard functions of Android


therevills(Posted 2011) [#4]
I wouldnt say impossible, in fact I would say it would be pretty easy to do:

After copying the Android template to the build folder, the Monkey Compiler just needs to alter the Android Manifest with the set code in something like a precompiler/preprocessor:

Strict

Import mojo

#APP_LABEL=My Super Android Game
#APP_PACKAGE=com.mysuperandroidgame
#SCREEN_ORIENTATION=portrait

Function Main:Int()
	new Game()
	Return 0
End

Class Game Extends App


Of course this would need either per target or be made very generic for all targets.


Uncle(Posted 2011) [#5]
+1 for this. Actually it could also work for other platforms. Orientation, Package Name etc are also important for iOS.


MikeHart(Posted 2011) [#6]
+1