Update the app to Marshmallow or Nougat

I had a Lollipop targeting app where permissions are granted during installation.
Then I aimed at Nougat (I missed Marshmallow because I didn't have time last year), so I had to create a permission request at runtime right after installation. This is normal, it took me a little time, but the application requests them without any problems and behaves correctly if not provided.

But, my problem:
I had thousands of users with the application installed, now after the upgrade they are asked to grant permissions again, even if they were already granted before the upgrade. As a result, I lose a lot of users every day. They believe that the application is requesting new permissions. It’s hard for me to explain to them that these permissions were granted before the update, and the application was not “dangerous”, in fact, many of these users have been using the application for a long time, but now they simply do not trust them.

So my question is: can I rollback somehow?
Can I make playstore respect the permissions that were already granted before the update?
I understand that permissions to execute must be for new installations, not for updates. I think google did it wrong here (again).

+4
source share
1 answer

I do not think so. This is a pain, I agree, but just what Google wants is to get rid of this permission scheme during installation, and then never ask again.

, imho, - , , , , Google, / .....

-

    /**
     * Check the application has Permissions
     *
     * @param context App context
     * @return Whether
     */

   static boolean hasPermissions(Context context, String[] permissions) {
        for (String p : permissions) {
            if (ActivityCompat.checkSelfPermission(context, p) != PackageManager.PERMISSION_GRANTED)
                return false;
        }
        return true;
    }

:

boolean hasMyPermissions = hasPermissions (context, {
            android.Manifest.permission.READ_CONTACTS,
            android.Manifest.permission.ACCESS_FINE_LOCATION,
            android.Manifest.permission.ACCESS_COARSE_LOCATION,
            android.Manifest.permission.CALL_PHONE,
            android.Manifest.permission.READ_EXTERNAL_STORAGE
    });

  if (!hasMyPermissions) {

       // open a cool activity / fragment / etc with graphics, fancy text, etc.. then
       // ask the user for permissions
        ActivityCompat.requestPermissions(context, permissions, PERMISSIONS_REQUEST_CODE);

  }

onRequestPermissionsResult:

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    if (requestCode == PERMISSIONS_REQUEST_CODE) {
        // permissions: Same String[] with your req permissions
        // grantresults: wether each individual permission has been granted or not
    }
}
0

Source: https://habr.com/ru/post/1670457/


All Articles