我想在我的游戏中添加一个按钮,用于在 Play 商店中打开我的应用程序的 URL。以下是我目前得到的结果,但是当我点击评分按钮时,它不会打开相应的 URL。
我的价格代码是:
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;
}
}
最佳答案
你真的应该使用 openURI Net 模块中的方法。
类似于:
Gdx.net.openURI("https://play.google.com/store/apps/details?id=com.shagunstudios.racinggame");
exec
可能不是跨平台的,至少不能在 Android 上运行。
不要重新发明轮子。
关于android - 在 libgdx 游戏中添加一个 "rate my app"按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17490901/