android 中未显示权限对话框

Permission dialog is not showing in android

我在我的 app.When 用户点击按钮时使用 Dexter library 获取相机权限 我想检查权限但是当我点击按钮时没有检查权限。

下面是我的代码:

class MainActivity : AppCompatActivity(), PermissionListener {
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)

    choose.setOnClickListener {
        Toast.makeText(applicationContext,"HEllo",Toast.LENGTH_SHORT).show();
        Dexter.withActivity(this)
            .withPermission(android.Manifest.permission.CAMERA)
            .withListener(this)
    }
}

override fun onPermissionGranted(response: PermissionGrantedResponse?) {
    Toast.makeText(applicationContext,"Granted",Toast.LENGTH_SHORT).show();
}

override fun onPermissionRationaleShouldBeShown(
    permission: PermissionRequest?,
    token: PermissionToken?
) {

}

override fun onPermissionDenied(response: PermissionDeniedResponse?) {
    Toast.makeText(applicationContext,"Denied",Toast.LENGTH_SHORT).show();
}
}  

我做错了什么?

请求权限时需要调用.check()

Dexter.withActivity(this)
            .withPermission(android.Manifest.permission.CAMERA)
            .withListener(this).check()