将Google Play登录添加到Surface View

时间:2018-03-14 08:57:53

标签: java android google-play-services surfaceview

我已阅读文档,任何指南仅解释,如何在活动中进行设置。我试过包括:

apiClient = new GoogleApiClient.Builder(this)
        .addApi(Games.API)
        .addScope(Games.SCOPE_GAMES)
        .enableAutoManage(this, new GoogleApiClient.OnConnectionFailedListener() {
    @Override
    public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
        Log.e(TAG, "Could not connect to Play games services");
        finish();
    }
}).build();

(示例代码)

在我的主要活动中加入我的oncreate方法,但因为main activity只不过是我的surfaceview的加载平台,它不起作用:

主要活动代码:

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // fullscreen
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        // Set No Title

        this.setContentView(new GameSurface(this));
    }

 }

我已尝试将其放入我的gamesurface课程背景中,但我无法使用getString将分数发布到我在开发者控制台中取得的高分。

有没有人设法用surfaceview做到这一点?我想过有一种方法可以打开另一个班级,然后进行登录,但是我如何将分数推向领导者?

如何查看排行榜? startActivityForResult无效。

基本上 我想要实现的是在游戏打开时自动登录。然后是getString的替代方案并打开排行榜。任何建议,将不胜感激。我已经有一段时间了。

0 个答案:

没有答案
相关问题