小编Mil*_*ood的帖子

getErrorDialog已折旧.什么是更新的功能,我该如何使用它?

我目前正在尝试将Drive API授权的使用合并到我的应用中.

Google开发人员指南声明我必须在我的连接失败方法中使用getErrorDialog.

但是,当我将getErrorDialog放入其中时,它声明该方法已被折旧,并且我需要使用"更新"版本.

但是,它没有说明我应该使用什么.

有谁知道这个功能的更新版本?

android

7
推荐指数
1
解决办法
4005
查看次数

MY_PERMISSONS_REQUEST没有定义?

我正在尝试检查应用的权限,目前我正在关注Android开发者培训.但是,在插入页面中列出的代码时遇到了问题.

该页面声称MY_PERMISSIONS_REQUEST是一个定义为常量的应用程序.但是,当我把它放在我的实际应用程序中时,它说它没有定义...

有人可以解释为什么会这样吗?谢谢!

示例代码:

// Here, thisActivity is the current activity
if (ContextCompat.checkSelfPermission(thisActivity,
                Manifest.permission.READ_CONTACTS)
        != PackageManager.PERMISSION_GRANTED) {

    // Should we show an explanation?
    if (ActivityCompat.shouldShowRequestPermissionRationale(thisActivity,
            Manifest.permission.READ_CONTACTS)) {

        // Show an expanation to the user *asynchronously* -- don't block
        // this thread waiting for the user's response! After the user
        // sees the explanation, try again to request the permission.

    } else {

        // No explanation needed, we can request the permission.

        ActivityCompat.requestPermissions(thisActivity,
                new String[]{Manifest.permission.READ_CONTACTS},
                MY_PERMISSIONS_REQUEST_READ_CONTACTS);

        // MY_PERMISSIONS_REQUEST_READ_CONTACTS is …
Run Code Online (Sandbox Code Playgroud)

android android-permissions

3
推荐指数
1
解决办法
1772
查看次数

标签 统计

android ×2

android-permissions ×1