[Bug after all] native.showPopup("appStore", options) with supportedAndroidStores set to "google" is sending me to Amazon store

It looks like the issue actually stems from the fact Simulator does not remember the Target App Store even though it does remember the Version Code, Package, Keystore, Key Alias and Save to Folder.  

Naomi


Public Release Build 1202, on Mac OSX v10.7.5

What used to work is now behaving wrong.  When I have the supportedAndroidStores set to “google”, it’s sending me to Amazon store:

[lua]

local options = {

    androidAppPackageName = “com.lavamind.beetlebounce”,

    supportedAndroidStores = { “google” }

}

native.showPopup(“appStore”, options)

[/lua]

When I execute the above code, it sends me to Amazon app store for Beetle Bounce (Kindle Tablet Edition).

The above code used to work (at least it was working with daily build 1196.)

Will this be fixed right away, or do I need to revert back to 1196…?

Naomi

I filed a bug report earlier this morning with the tiniest test project ever (only a button that calls a function that runs the code posted on the initial thread.)  I’ll post back the case number when I get it.

Please note, the device build is for Google Play, and I really don’t want native.showPopup to open up Amazon app store.

Naomi

Edit 1:  I was testing something else, and for the first time since I got back to working on Google Play version, I noticed I still had Target App Store set to Amazon (on Build for Android popup window.)  Yikes.  

Edit 2:  That said… isn’t it still strange that even after specifically stating that the supportedAndroidStores is “google”, it still opens Amazon app store?  It feels it’s ignoring the value specified in supportedAndroidStores…  And if so, what is the purpose of adding supportedAndroidStores?

Naomi,

We’ve actually modified the app store popup behavior (I think in the previous release) to favor the app store that your app targets in the Android Build window, regardless if it is in your supportedAndroidStores list.  The reason was to handle the case where multiple app stores are available on the device, which is a common case when the Amazon app store reviewers test apps.  Corona needs some kind of clue as to which store to favor and the “Target App Store” is the one that wins.

So, I’m thinking when you built your APK, you’ve set it up to target the Amazon app store.  If you change the target to “Google Play”, then it will display a popup for that store instead.

Yup, you are right on, Joshua.  I realized it and felt properly ashamed.  Thank you for further clarifying why “Target App Store” takes precedence over supportedAndroidStores list.

Naomi

Looks like there’s a bit more to this than I thought.

The thing is, this morning, when I first tried to generate a device build, it’s selecting Amazon as the Target App Store.  But yesterday, I set it to Google Play.  

Build for Android window remembers the Version Code, Package, Keystore, Key Alias and Save to Folder from yesterday, but it won’t remember the Target App Store.  

At this point, I honestly think that was probably the reason why I thought things were not working anymore – because I had built Google Play version of the app in the past few days, and the first time I started working on it, I’m pretty sure I selected Google Play (because Version Code for Amazon and Version Code for Google Play are not the same), and then I no longer thought twice about it – because I don’t remember ever needing to set Target App Store every time I launch the Simulator and generate a device build first time.

Naomi

The target app store is definitely never forgotten.  I know because other features and plugins depend on it.  You can fetch the determine which store your app is targeting by calling the system.getInfo(“targetAppStore”) function as documented here…
   http://docs.coronalabs.com/daily/api/library/system/getInfo.html#targetappstore
 
The above will return “google” if your app is targeting the Google Play store.
 
The only thing that I can think of that is preventing this from working is if Corona is failing to find the Google Play app on your device.  The native.showPopup(“appStore”) function will return false if Corona fails to find the app store you are targeting or list as supported.  So, does the following return false for you?

local settings = { androidAppPackageName = "com.rovio.angrybirds", } local wasShown = native.showPopup("appStore", settings) print("\*\*\* App Store Popup Shown = " .. tostring(wasShown))

Sorry, I wasn’t clear.  What happens is, if/when you close Simulator, and then relaunch Simulator, the first time you generate device build, it won’t remember the target app store but always default to Amazon.

For example, I may generate a device build for Amazon.  I then generate a device build for Google Play – but before doing so, I’d update the Version Code, etc., to match with Google Play version.  And then, if I don’t shut down Simulator, it will remember the latest set up, including the target app store.  

However, if I quit Simulator, and then relaunch it, the first time I try generating a device build, it will remember the last setting except for the target app store.  The target app store is now reset to Amazon, and I’d have to change it to Google Play before generating a build.

This is not the biggest problem, especially if we are all aware that we need to always reset the target app store after quitting Simulator and restarting it – otherwise, it can easily trip people like me, who quits Simulator at the end of the day and relaunch it the next morning.

Naomi

Oh I see.  You’re saying that the Corona Simulator is forgetting your last app store target in the build window, right?

I’m guessing you’re talking about the Mac version of the Corona Simulator, because the Windows version does not have this problem.

Yes, Joshua, it’s on Mac version of the Corona Simulator, and only after the Simulator is shut down and then restarted.  Because all the other setting is saved, it’s so easy not to notice that the target app store setting must be reset.  

Again, this isn’t a big bug, but it could easily cause issues when we unknowingly build for Amazon app store while it is intended to be built for other app store.

Naomi

I filed a bug report earlier this morning with the tiniest test project ever (only a button that calls a function that runs the code posted on the initial thread.)  I’ll post back the case number when I get it.

Please note, the device build is for Google Play, and I really don’t want native.showPopup to open up Amazon app store.

Naomi

Edit 1:  I was testing something else, and for the first time since I got back to working on Google Play version, I noticed I still had Target App Store set to Amazon (on Build for Android popup window.)  Yikes.  

Edit 2:  That said… isn’t it still strange that even after specifically stating that the supportedAndroidStores is “google”, it still opens Amazon app store?  It feels it’s ignoring the value specified in supportedAndroidStores…  And if so, what is the purpose of adding supportedAndroidStores?

Naomi,

We’ve actually modified the app store popup behavior (I think in the previous release) to favor the app store that your app targets in the Android Build window, regardless if it is in your supportedAndroidStores list.  The reason was to handle the case where multiple app stores are available on the device, which is a common case when the Amazon app store reviewers test apps.  Corona needs some kind of clue as to which store to favor and the “Target App Store” is the one that wins.

So, I’m thinking when you built your APK, you’ve set it up to target the Amazon app store.  If you change the target to “Google Play”, then it will display a popup for that store instead.

Yup, you are right on, Joshua.  I realized it and felt properly ashamed.  Thank you for further clarifying why “Target App Store” takes precedence over supportedAndroidStores list.

Naomi

Looks like there’s a bit more to this than I thought.

The thing is, this morning, when I first tried to generate a device build, it’s selecting Amazon as the Target App Store.  But yesterday, I set it to Google Play.  

Build for Android window remembers the Version Code, Package, Keystore, Key Alias and Save to Folder from yesterday, but it won’t remember the Target App Store.  

At this point, I honestly think that was probably the reason why I thought things were not working anymore – because I had built Google Play version of the app in the past few days, and the first time I started working on it, I’m pretty sure I selected Google Play (because Version Code for Amazon and Version Code for Google Play are not the same), and then I no longer thought twice about it – because I don’t remember ever needing to set Target App Store every time I launch the Simulator and generate a device build first time.

Naomi

The target app store is definitely never forgotten.  I know because other features and plugins depend on it.  You can fetch the determine which store your app is targeting by calling the system.getInfo(“targetAppStore”) function as documented here…
   http://docs.coronalabs.com/daily/api/library/system/getInfo.html#targetappstore
 
The above will return “google” if your app is targeting the Google Play store.
 
The only thing that I can think of that is preventing this from working is if Corona is failing to find the Google Play app on your device.  The native.showPopup(“appStore”) function will return false if Corona fails to find the app store you are targeting or list as supported.  So, does the following return false for you?

local settings = { androidAppPackageName = "com.rovio.angrybirds", } local wasShown = native.showPopup("appStore", settings) print("\*\*\* App Store Popup Shown = " .. tostring(wasShown))

Sorry, I wasn’t clear.  What happens is, if/when you close Simulator, and then relaunch Simulator, the first time you generate device build, it won’t remember the target app store but always default to Amazon.

For example, I may generate a device build for Amazon.  I then generate a device build for Google Play – but before doing so, I’d update the Version Code, etc., to match with Google Play version.  And then, if I don’t shut down Simulator, it will remember the latest set up, including the target app store.  

However, if I quit Simulator, and then relaunch it, the first time I try generating a device build, it will remember the last setting except for the target app store.  The target app store is now reset to Amazon, and I’d have to change it to Google Play before generating a build.

This is not the biggest problem, especially if we are all aware that we need to always reset the target app store after quitting Simulator and restarting it – otherwise, it can easily trip people like me, who quits Simulator at the end of the day and relaunch it the next morning.

Naomi

Oh I see.  You’re saying that the Corona Simulator is forgetting your last app store target in the build window, right?

I’m guessing you’re talking about the Mac version of the Corona Simulator, because the Windows version does not have this problem.

Yes, Joshua, it’s on Mac version of the Corona Simulator, and only after the Simulator is shut down and then restarted.  Because all the other setting is saved, it’s so easy not to notice that the target app store setting must be reset.  

Again, this isn’t a big bug, but it could easily cause issues when we unknowingly build for Amazon app store while it is intended to be built for other app store.

Naomi