【问题标题】:Google Play Games Services View for Popups弹出窗口的 Google Play 游戏服务视图
【发布时间】:2014-12-26 01:03:35
【问题描述】:

我刚刚为我的游戏集成了 Google Play 游戏服务。在日志猫中,我看到一条警告说:

"10-29 23:13:29.559: W/PopupManager(6985): You have not specified a View to use as content view for popups. Falling back to the Activity content view which may not work properly in future versions of the API. Use setViewForPopups() to set your content view."

这是我应该担心的事情吗? Google 的默认视图和布局对我来说没问题。此外,如果我按下主页按钮或进入排行榜活动中的设置,它会显示强制关闭 - 没有弹出窗口视图是导致该问题的原因吗?

【问题讨论】:

  • 不是真正的重复,因为他因其他错误而崩溃,我认为他没有解决此警告消息。
  • @Barodapride - 你有没有发现这实际上是什么?我的 LogCat 中有这个,但一切正常。
  • 我认为我无法解决它。只是忍受警告。
  • 我记得同样的问题,我认为它消失了:pastebin.com/qTyicmWy

标签: java android google-play-games


【解决方案1】:

这应该可以正常工作:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "onCreate");

    setContentView(R.layout.activity_main);

    // Create the Google API Client with access to Plus, Games and Drive
    // Also set the view for popups
    mGoogleApiClient = new GoogleApiClient.Builder(getApplicationContext())
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN)
            .addApi(Games.API).addScope(Games.SCOPE_GAMES)
            .addApi(Drive.API).addScope(Drive.SCOPE_APPFOLDER)
            .setViewForPopups(findViewById(android.R.id.content))
            .build();

}

android.R.id.content 为您提供视图的根元素,而无需知道其实际名称/类型/ID。查看从当前活动获取根视图

【讨论】:

    猜你喜欢
    • 2013-09-27
    • 2015-03-01
    • 1970-01-01
    • 2014-02-02
    • 2018-06-17
    • 1970-01-01
    • 2013-07-31
    • 2017-09-27
    相关资源
    最近更新 更多