[Solved] How to remove “Never ask again” text in this popup?


How can I request the permission popup without “Never ask again” text?

NO you can not remove “Never ask again” from Permission Dialog

try this this hack if user selects Never ask again

ask for permission like this

 btnCurrentLocationSearch.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String permission = android.Manifest.permission.ACCESS_FINE_LOCATION;


                if (ActivityCompat.checkSelfPermission(SearchCityClass.this, permission)
                        != PackageManager.PERMISSION_GRANTED && ActivityCompat.
                        checkSelfPermission(SearchCityClass.this, android.Manifest.permission.ACCESS_COARSE_LOCATION)
                        != PackageManager.PERMISSION_GRANTED) {

                    Toast.makeText(SearchCityClass.this, "Permission not granted", Toast.LENGTH_SHORT).show();

                    ActivityCompat.requestPermissions(SearchCityClass.this, new String[]
                            {permission}, requestCode);

                } else {
                    isPermissionGranted(true);
                }
            }

        });

than handle permission result in onRequestPermissionsResult

    @Override
        public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
            super.onRequestPermissionsResult(requestCode, permissions, grantResults);
            if (requestCode == requestCode) {
                if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {

                    isPermissionGranted(true);
                } else {

                    isPermissionGranted(false);
                }
            }
        }

than create a method like this

public void isPermissionGranted(boolean permission) {
        if (!permission) {
            Toast.makeText(this, "Permission not Granted", Toast.LENGTH_SHORT).show();
            startActivity(new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
                    Uri.fromParts("package", getPackageName(), null)));
        } else {
            Toast.makeText(SearchCityClass.this, "true", Toast.LENGTH_SHORT).show();
            Toast.makeText(SearchCityClass.this, "Permission granted", Toast.LENGTH_SHORT).show();
            // you need to perform all action here if user grants the permission
        }
    }

solved How to remove “Never ask again” text in this popup?