ActivityCompat.requestPermissions not showing dialog box

前端 未结 20 1446
野趣味
野趣味 2020-12-07 17:15
if (ContextCompat.checkSelfPermission(RegisterActivity.this,      Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_DENIED){
            ActivityCom         


        
相关标签:
20条回答
  • 2020-12-07 18:11

    For me the error was in the manifest: the permission was in uppercase. Android Studio suggest me the permissions in uppercase. I don't care about that and it took me two hours to fixe this problem.

    The right syntaxe for permission is
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

    0 讨论(0)
  • 2020-12-07 18:12

    Replace:

    ActivityCompat.requestPermissions(this, new String[]{"Manifest.permission.READ_PHONE_STATE"}, 225);
    

    with:

    ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_PHONE_STATE}, 225);
    

    The actual string for that permission is not "Manifest.permission.READ_PHONE_STATE". Use the symbol Manifest.permission.READ_PHONE_STATE.

    0 讨论(0)
提交回复
热议问题