android - Google Game Play Service Achievement 不弹出

标签 android google-play-games achievements

我尝试在我的游戏中实现 Game Play Service Achievement,但是当成就解锁时,它不会弹出(显示成就已解锁)但是当我打开所有成就列表时它显示已解锁。所以我的问题是,如何在解锁时弹出成就?

MainActivity.class

 public static GoogleApiClient mGoogleApiClient;
  private void callGooglePlay(){  
        mGoogleApiClient = new GoogleApiClient.Builder(getApplicationContext())
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
                .addApi(Games.API).addScope(Games.SCOPE_GAMES)
                .build();
    }

PlayActivity.class

 Games.Achievements.unlock(MainMenu.mGoogleApiClient, getResources().getString(R.string.e));

最佳答案

您需要调用getAchievementsIntent()来创建默认成就UI,然后调用startActivityForResult

startActivityForResult(Games.Achievements.getAchievementsIntent(mGoogleApiClient),REQUEST_ACHIEVEMENTS);

关于 displaying achievements 的更多信息可以在文档中找到。

如果您需要特定于解锁成就的通知,您可以尝试使用 [setViewForPopups]( https://developers.google.com/android/reference/com/google/android/gms/games/Games.html#setViewForPopups(com.google.android.gms.common.api.GoogleApiClient , android.view.View)) this question 中的建议.

关于android - Google Game Play Service Achievement 不弹出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39851367/

相关文章:

android - 使用未签名的 APK 测试 Google Play 服务

android - Unity - Google Play 游戏服务不工作?

android - 将 Google Play 游戏服务添加到现有应用

ios7 - iOS 7 中没有显示成就通知横幅

android - 如何更新谷歌播放的增量成就

android - java.lang.NullPointerException - AutoCompleteTextView - hive

java - Android Studio 构建 NDK {NDK_PROJECT_PATH=null} 错误 87 => 错误 1

android - 更改应用程序中的选项卡名称

android - Flash Builder,为移动设备加载资源

android - 在 OpenFeint 中解锁成就