
This is a feature Steve added way back in June but I didn’t get around to documenting it. Build hints can sometimes get “unwieldy” e.g. in the case of ios.plistInject or android.xapplication we sometimes have pretty verbose values.
We now have a way to define a “build hint variable” which the build server substitutes seamlessly. This is useful for “key” values required by API’s that sometimes require boilerplate e.g. the Google Maps support has this:
android.xapplication=<meta-data android_name="com.google.android.maps.v2.API_KEY" android_value="YOUR_ANDROID_API_KEY"/>
Notice that the one thing that actually matters here is YOUR_ANDROID_API_KEY which makes this problematic. We can’t add this string to the build hints automatically because this is a value you need to set…
The variables allow us to do this instead:
var.androidAPIKey=YOUR_ANDROID_API_KEY
android.xapplication=<meta-data android_name="com.google.android.maps.v2.API_KEY" android_value="${var.androidAPIKey}"/>
This might seem more verbose but notice that the cn1lib can now inject the second line automatically and you will need to add this single line: var.androidAPIKey=YOUR_ANDROID_API_KEY
That is far simpler than before and less error prone.
Most cn1libs still don’t take advantage of this syntax but hopefully we’ll move them in that direction as we move forward.
Archived Comments
This post was automatically migrated from the legacy Codename One blog. The original comments are preserved below for historical context. New discussion happens in the Discussion section.
Gareth Murfin — August 5, 2016 at 12:35 pm (permalink)
Gareth Murfin says:
Had not even considered this, very useful indeed!
Torjmen Hamza — April 30, 2017 at 12:28 pm (permalink)
Torjmen Hamza says:
Hello,
I have problems with Google Maps in Codename One, I tried to make a useful path like DirectionRoute in javascript but it is always a black line, it’s like that i have airlines, could some one help me with that ?
Shai Almog — May 1, 2017 at 3:52 am (permalink)
Shai Almog says:
Hi,
why not ask that in the maps post https://www.codenameone.com…
I suggest asking there and mentioning what you did.
Discussion
Join the conversation via GitHub Discussions.