Search code examples
codenameone

Launch to google play and iOS app store to download a different app


I have separate user and PRO app. If a user downloads the PRO app I would like to give them the option to download the user version with a simple button to take them to download the user version from the relevant store. I'm looking for some guidance on the best way to achieve this.


Solution

  • You can use CN.execute("uri of my app"). You can check the CN.getProperty("Platform", "android").equals("ios") to check if this is iOS and use the itunes URL. Otherwise you can use the Android URL.

    On the desktop this will open the browser but on the device it will launch the appstore.

    See this post: https://www.codenameone.com/blog/rating-widget.html