I'm trying to have my launcher badge determine if it should install or launch my app on click. So when the user clicks, it checks for the app version using getApplicationVersion(), inside that callback, I'm either using launchApplication() or installApplication() based on the version number. But installApplication() doesn't want to run when it's inside the getApplicationVersion() callback.
Has anyone run into this before? Am I using things correctly?
I believe this is failing because installApplication() and launchApplication() require a confirmed user interaction to function. If you're calling getApplicationVersion() on init, you won't be able to automatically call install/launch in the callback. Instead, what typically would occur is that the badge graphic would be update (to either "install" or "launch") and the user would click, causing the confirmed user interaction that the functions require. The same problem occurs if you click and call getApplicationVersion(), during the callback you won't be able to use install/launch because the click event would have been used up for getApplicationVersion().
You might want to take a look at how the custom install badge works (see Getting started with the custom install badge). In that example, getApplicationVersion is called during init and updates the badge appropriately.
Hope this helps,
Thanks, Chris. This makes good sense.