ActivityCompat.requestPermissions not showing dialog box

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


        
20条回答
  •  无人及你
    2020-12-07 17:58

    I had a need to request permission for WRITE_EXTERNAL_STORAGE but was not getting a pop-up despite trying all of the different suggestions mentioned.

    The culprit in the end was HockeyApp. It uses manifest merging to include its own permission for WRITE_EXTERNAL_STORAGE except it applies a max sdk version onto it.

    The way to get around this problem is to include it in your Manifest file but with a replace against it, to override the HockeyApp's version and success!

    4.7.2 Other dependencies requesting the external storage permission (SDK version 5.0.0 and later) To be ready for Android O, HockeySDK-Android 5.0.0 and later limit the WRITE_EXTERNAL_STORAGE permission with the maxSdkVersion filter. In some use cases, e.g. where an app contains a dependency that requires this permission, maxSdkVersion makes it impossible for those dependencies to grant or request the permission. The solution for those cases is as follows:

    
    

    It will cause that other attributes from low priority manifests will be replaced instead of being merged.

    https://support.hockeyapp.net/kb/client-integration-android/hockeyapp-for-android-sdk#permissions-advanced

提交回复
热议问题