Warnings Your Apk Is Using Permissions That Require A Privacy Policy: (android.permission.READ_PHONE_STATE)

前端 未结 20 1225
孤独总比滥情好
孤独总比滥情好 2020-12-01 00:53

In manifest not added android.permission.READ_PHONE_STATE. permission.

Why error comes when I upload a new apk version error comes below.

Your app has an apk w

相关标签:
20条回答
  • 2020-12-01 01:44

    If you are using the package device_id to get the unique device id then that will add an android.permission.READ_PHONE_STATE without your knowledge which eventually will lead to the Play Store warning.

    Instead you can use the device_info package for the same purpose without the need of the extra permission. Check this SO thread

    0 讨论(0)
  • 2020-12-01 01:45

    you need to specify the min and target sdk version in the manifest file.
    If not the android.permission.READ_PHONE_STATE will be added automaticly while exporting your apk file.

    <uses-sdk
            android:minSdkVersion="9"
            android:targetSdkVersion="19" />
    
    0 讨论(0)
  • 2020-12-01 01:45

    Currently some people are facing the same issue because of using 12.0.0 version of AdMob lib.

    Update it to 12.0.1. This should fix it. You can read more here

    0 讨论(0)
  • 2020-12-01 01:47

    You should drop android.permission.READ_PHONE_STATE permission. Add this to your manifest file:

    <uses-permission
        android:name="android.permission.READ_PHONE_STATE"
        tools:node="remove" />
    
    0 讨论(0)
  • 2020-12-01 01:48

    It can be that you need to add or update your privacy policy. You can easily create a privacy policy using this template

    https://app-privacy-policy-generator.firebaseapp.com/

    0 讨论(0)
  • 2020-12-01 01:50

    If you're testing your app on a device > android 6.0 you have also to explicitely ask the user to grant the permission.

    As you can see here READ_PHONE_STATE have a dangerous level.

    If a permission have a dangerous level then the user have to accept or not this permission manually. You don't have the choice, you MUST do this

    To do this from your activity execute the following code :

    if the user use Android M and didn't grant the permission yet it will ask for it.

    public static final int READ_PHONE_STATE_PERMISSION = 100;
    
      if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M && checkSelfPermission(Manifest.permission.READ_PHONE_STATE)
                    != PackageManager.PERMISSION_GRANTED) {
                requestPermissions(new String[]{Manifest.permission.READ_PHONE_STATE}, READ_PHONE_STATE_PERMISSION);
            }
    

    then override onRequestPermissionsResult in your activity

    @Override
        public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
            switch (requestCode){
                case READ_PHONE_STATE_PERMISSION: {
                    if (grantResults[0] == PackageManager.PERMISSION_GRANTED){
                        //Permission granted do what you want from this point
                    }else {
                        //Permission denied, manage this usecase
                    }
                }
            }
        }
    

    You should read this article to know more about it

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