我目前正在尝试将 Drive API 授权的使用整合到我的应用中。
Google Developers Guide 指出我必须在我的连接失败方法中使用 getErrorDialog。
但是,当我放入 getErrorDialog 时,它指出该方法已过时,我需要使用“更新”版本。
但是,它没有说明我应该使用什么。
有谁知道这个函数的更新版本吗?
最佳答案
However, when I put the getErrorDialog in, it stated that the method was depreciated, and that I needed to use an 'updated' version.
GooglePlayServicesUtil.getErrorDialog
已被弃用,取而代之的是 GoogleApiAvailability.getErrorDialog
,它不是 GooglePlayServicesUtil
的静态方法。您可以通过这种方式获取 GoogleApiAvailability
的实例
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
并对返回的实例调用getErrorDialog
apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST).show();
这是 Context
的对象,resultCode
是 isGooglePlayServicesAvailable(Context)
的返回值。您可以阅读更多相关信息 here
关于android - getErrorDialog 已贬值。更新后的功能是什么,我该如何使用它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38375849/