How can I get the "Build As" target type?

I need to know how to get the “Build As” target type in my lua code.

The reason for this is so I can have the correct link to the right app store depending if it is the Android Market or the Amazon App Store.

Unless I am missing something there isn’t any method of getting any useful info unless I am running on a Kindle Fire. All other droid devices will just return device names for the system.getInfo(“model”) call.

Since we have to explicitly build for one market or the other, there should be a system.getInfo() call to return the market.

How about something like: system.getInfo(“market”) and it can return one of the following based on the Build As option:

  • Apple

  • Android

  • Amazon

  • Barnes and Noble

[import]uid: 16734 topic_id: 20668 reply_id: 320668[/import]

Well you could do what I do for my pay vs. lite game…

Include a variable at the top that says its free or pay:

\_G.isPaid = true -- or or false. If you're using Storyboard, I'd make this:  
-- storyboard.isPaid = true  

Later in the program, when I have a specific feature that only paid gets:

if \_G.isPaid then  
 -- code for the feature  
end  

You could do the same thing:

\_G.market = "Apple"  
--\_G.market = "Amazon"  
--\_G.market = "BN"  
--\_G.market = "Android"  

then when you have a market specific feature

  
if \_G.market == "Apple" then  
 -- include apple specific code  
elseif \_G.market == "Android" then  
 -- include android specific code  
elseif \_G.market == "BN" then  
 -- Nook specific content  
else  
 -- Amazon specific code  
end  
  

You’re going to have to do all of that anyway, the only difference is you set a flag in the code instead of an entry from the build system which really wouldn’t work anyway because you may want to test in the simulator which won’t know what your build target it anyway. This method works even in the simulator.
[import]uid: 19626 topic_id: 20668 reply_id: 81096[/import]

@rob,

I didn’t mean to imply that there aren’t ways around this, just that this seems like something that Ansca should provide.

I do something slightly different than what you suggested. I use a file as a flag for the market type, and copy the appropriate file to my staging area before I make a release build using a batch or shell script. Then I just test for the file at start up.

The problem with setting it in code is it is VERY easy to forget what flags you’ve set up. Even if you remember, if you want to make builds for each platform and market you have to edit your file, change the flags, then select the correct build. Is that straight forward? Sure, but not as straight forward as getting a value from Corona.

Given that we are build a SPECIFIC build type via the Corona Build As option, it should be a value that Corona can provide to us.

[edit] Just saw your final paragraph. You are correct, you need to test. So either they ad a “Test As” (which I doubt they ever will) or you have to use either your approach or the approach I currently use with the file semaphore. [import]uid: 16734 topic_id: 20668 reply_id: 81102[/import]