Adding a "rate my app" button in libgdx game

android, libgdx

Solution

You should really be using openURI method in the Net module.

Something like:

Gdx.net.openURI("https://play.google.com/store/apps/details?id=com.shagunstudios.racinggame");

`exec` is probably not cross platform and will not work on Android at the least. Don't re-invent the wheel.

Problem

I want add a button in my game that will open up an URL to my app in Play Store. Below is what I got so far, but when I click on rate button it does not open the respective URL. My rate code is: ``` if(Gdx.input.justTouched()){ guiCam.unproject(touchPoint.set(Gdx.input.getX(),Gdx.input.getY(), 0)); if(OverlapTester.pointInRectangle(rateButtonBound, touchPoint.x, touchPoint.y)){ try { Process p = Runtime.getRuntime().exec("cmd /c start https://play.google.com/store/apps/details?id=com.shagunstudios.racinggame"); } catch (IOException e1) { System.out.println(e1); } if(Settings.soundEnabled) Assets.click_sound.play(1.0f); return; } } ```

Original source