Hi all, we are currently developing our next app and experience a very strange problem: Whenever we execute "ActivityCompat.requestPermissions" the app shows the request dialog but at the same time the screen becomes white. The dialog stays until an answer is selected and afterwards the screen stays white. Additionally, the onRequestPermissionsResult method is NOT called. When pressing the screen, nothing happens. When pressing the back button, the app crashes. When restarting the app, the selection about the permission is remembered.
The main problem is that we do not get any exception or unexpected messages (and of course the app should not show a white screen - indeed nothing should happen except that the missing persmission is requested). We also searched for a solution but did not find any similar posts (only some people saying that the permission has to be listed in the manifest which it is). Did anyone before experience such a problem? We implemented the new permission model several times before but never experiences such a behaviour. Since no errors or logs are generated we do not know how to trace the source of the problem. Thanks for any help, Thomas *We want to get the GPS coordinates of the user (which he or she initiiated by clicking an image button). We check for the permission in the onClick-method:* *private class GPSOnClickListener implements View.OnClickListener{ private final LocationActivity source; public GPSOnClickListener(LocationActivity source) { this.source = source; } @Override public void onClick(View v) { if (checkAndAskForPermission(source, new String[]{Manifest.permission.ACCESS_FINE_LOCATION},getString(R.string.activity_download_permission_internet_request), PermissionRequests.ACTIVITY_DOWNLOAD_LOCATION_ACCESS_REQUEST)) { getDialogHelper().showSpinnerProgressDialog(getString(R.string.activity_location_progressdialog_position_message)); positionHelper.startSeekingPosition(); } else Log.d(this.getClass().getName(),"Could not locate, missing permission..."); }}*The method checking and asking for the permission: public boolean checkAndAskForPermission(Activity activity, String[] permissions, String explanation, int permissionId) { Log.d(this.getClass().getName(), "Checking permissions for " + Arrays.asList(permissions)); ArrayList<String> permList = new ArrayList<>(); for (String perm: permissions) { if (ActivityCompat.checkSelfPermission(this, perm) != PackageManager.PERMISSION_GRANTED) permList.add(perm); if (ActivityCompat.shouldShowRequestPermissionRationale(this, perm)) { Log.d(this.getClass().getName(),"Showing dialog to explain permission: "+perm); this.getDialogHelper().showAlertDialog(getString(R.string.app_permissions_title), explanation, null); } } if (permList.size() == 0) { Log.d(this.getClass().getName(), "Permissions already granted!"); return true; } else { Log.d(this.getClass().getName(), "Missing permissions. Requesting " + permList); ActivityCompat.requestPermissions(activity,permList.toArray(new String[permList.size()]), permissionId); Log.d(this.getClass().getName(), "Missing permissions. Requested "+permList); return false; } } The method that should get the response: @Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { case PermissionRequests.ACTIVITY_DOWNLOAD_LOCATION_ACCESS_REQUEST: { // If request is cancelled, the result arrays are empty. if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { getDialogHelper().showSpinnerProgressDialog(getString(R.string.activity_location_progressdialog_position_message)); positionHelper.startSeekingPosition(); } else { getDialogHelper().showAlertDialog(getString(R.string.errordialog_title), getString(R.string.activity_location_errordialog_position_message_denied), null); } return; } } } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/e119411f-4e2b-48a5-8cdb-473a777c6d54%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.