Package 

Class FragmentCompat

    • Constructor Detail

      • FragmentCompat

        FragmentCompat()
    • Method Detail

      • requestPermissions

        @Deprecated() static void requestPermissions(@NonNull() Fragment fragment, @NonNull() Array<String> permissions, int requestCode)

        Requests permissions to be granted to this application. These permissionsmust be requested in your manifest, they should not be granted to your app,and they should have protection level #PROTECTION_DANGEROUS dangerous, regardless whether they are declared bythe platform or a third-party app.

        Normal permissions PROTECTION_NORMAL are granted at install time if requested in the manifest. Signature permissions PROTECTION_SIGNATURE are granted atinstall time if requested in the manifest and the signature of your app matchesthe signature of the app declaring the permissions.

        If your app does not have the requested permissions the user will be presentedwith UI for accepting them. After the user has accepted or rejected therequested permissions you will receive a callback reporting whether thepermissions were granted or not. Your fragment has to implement and the results of permission requests will be delivered to its onRequestPermissionsResult.

        Note that requesting a permission does not guarantee it will be granted andyour app should be able to run without having this permission.

        This method may start an activity allowing the user to choose which permissionsto grant and which to reject. Hence, you should be prepared that your activitymay be paused and resumed. Further, granting some permissions may requirea restart of you application. In such a case, the system will recreate theactivity stack before delivering the result to your onRequestPermissionsResult(int, String[], int[]).

        When checking whether you have a permission you should use String).

        Parameters:
        fragment - The target fragment.
        permissions - The requested permissions.
        requestCode - Application specific request code to match with a resultreported to onRequestPermissionsResult.
      • shouldShowRequestPermissionRationale

        @Deprecated() static boolean shouldShowRequestPermissionRationale(@NonNull() Fragment fragment, @NonNull() String permission)

        Gets whether you should show UI with rationale for requesting a permission.You should do this only if you do not have the permission and the context inwhich the permission is requested does not clearly communicate to the userwhat would be the benefit from granting this permission.

        For example, if you write a camera app, requesting the camera permissionwould be expected by the user and no rationale for why it is requested isneeded. If however, the app needs location for tagging photos then a non-techsavvy user may wonder how location is related to taking photos. In this caseyou may choose to show UI with rationale of requesting this permission.

        Parameters:
        fragment - The target fragment.
        permission - A permission your app wants to request.