Open zourb opened 5 years ago
The main point described above is: immediate permission request if there has been some pending requests after configuration change will result the empty permissions and results arrays which should be treated as a cancellation in the onRequestPermissionsResult callback.
/**
* Callback for the result from requesting permissions. This method
* is invoked for every call on {@link #requestPermissions(String[], int)}.
* <p>
* <strong>Note:</strong> It is possible that the permissions request interaction
* with the user is interrupted. In this case you will receive empty permissions
* and results arrays which should be treated as a cancellation.
* </p>
*
* @param requestCode The request code passed in {@link #requestPermissions(String[], int)}.
* @param permissions The requested permissions. Never null.
* @param grantResults The grant results for the corresponding permissions
* which is either {@link android.content.pm.PackageManager#PERMISSION_GRANTED}
* or {@link android.content.pm.PackageManager#PERMISSION_DENIED}. Never null.
*
* @see #requestPermissions(String[], int)
*/
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
/* callback - do nothing */
}
thus, the permission entry of mSubjects in RxPermissionsFragment won't be removed.
The working demo: https://github.com/zourb/RxPermissions
Reproduce procedure in sample project: