Android 为什么我们要用这个密码,有人能告诉我吗

Android 为什么我们要用这个密码,有人能告诉我吗,android,Android,submitButtonLayout=LinearLayout findViewByIdR.id.submit_按钮布局 submitButtonLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int permissionCheck = ContextCompat.checkSelfPerm

submitButtonLayout=LinearLayout findViewByIdR.id.submit_按钮布局

    submitButtonLayout.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            int permissionCheck = ContextCompat.checkSelfPermission(context,  android.Manifest.permission.READ_PHONE_STATE);

            if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
                ActivityCompat.requestPermissions((Activity) context, new String[]{ android.Manifest.permission.READ_PHONE_STATE}, Utils.REQUEST_READ_PHONE_STATE);
            } else {
                loginAction();
            }
        }
    });

您需要的基本概述。浏览链接以获取有关实施和其他限制的更多详细信息。

对于具有棉花糖或更高版本操作系统的设备,此代码用于检查棉花糖或更高版本操作系统的权限。如果允许读取电话状态,则登录;否则将调用弹出窗口打开以授予读取电话状态的权限检查此感谢兄弟Zaki Pathant谢谢兄弟mohammed atif Beginning in Android 6.0 (API level 23), users grant permissions to apps while the app is running, not when they install the app. This approach streamlines the app install process, since the user does not need to grant permissions when they install or update the app. It also gives the user more control over the app's functionality; for example, a user could choose to give a camera app access to the camera but not to the device location. The user can revoke the permissions at any time, by going to the app's Settings screen.