title: `onRequestPermissionsResult()` is not working in Fragment-Kotlin
body: <p><strong>Problem:</strong></p>
  <p>I have done this <code>LocationPermission</code> task with activity but I want to do it with the fragment. In Fragment method <code>onRequestPermissionsResult()</code> is not being called.</p>
  <p>There are many answers to this question but unfortunately non of them worked for me. Some of those answers are in java which is not applicable in kotlin, for instance, one answer says using 'FragmentCompat' this problem can be solved but we don't have <code>FragmentCompat</code> in Kotlin.</p>
  <p><strong>What I did so far?</strong></p>
  <p>I followed <a href="https://stackoverflow.com/questions/35989288/onrequestpermissionsresult-not-being-called-in-fragment-if-defined-in-both-fragm">this</a> question and many others.</p>
  <p><strong>Before</strong> <code>ActivityCompat.requestPermissions(requireActivity(), arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), 1) </code></p>
  <p><strong>After:</strong>
  <code> requestPermissions(arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),1)</code></p>
  <p>though <code>requestPermissions</code> is depricated But nothing worked so far.</p>
  <p><strong>PLEASE DO CONSIDER KOTLIN LANGUAGE FOR ANSWERS</strong></p>
  <p><strong>Code in Fragment:</strong></p>
  <pre><code>fun RequestLocationPermission()
      {
          Log.d(TAG, &quot;RequestLocationPermission: &quot;)
          if(ContextCompat.checkSelfPermission(requireContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)
          {
              if(ActivityCompat.shouldShowRequestPermissionRationale(requireActivity(), Manifest.permission.ACCESS_FINE_LOCATION)){
                  requestPermissions(arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),1)
              }
              else{
                  ActivityCompat.requestPermissions(requireActivity(), arrayOf(Manifest.permission.ACCESS_FINE_LOCATION), 1)
                  requestPermissions(arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),1)
              }
          }
      }
  </code></pre>
  <pre><code> override fun onRequestPermissionsResult(
          requestCode: Int,
          permissions: Array&lt;String&gt;,
          grantResults: IntArray
      ) {
          Toast.makeText(requireContext(), &quot;Request Permission Called&quot;, Toast.LENGTH_SHORT).show()
          Log.d(TAG, &quot;onRequestPermissionResult Called &quot;)
  
          when (requestCode) {
              1 -&gt; when {
                  grantResults.isEmpty() -&gt;
                      // If user interaction was interrupted, the permission request
                      // is cancelled and you receive empty arrays.
                      Log.d(TAG, &quot;User interaction was cancelled.&quot;)
                  grantResults[0] == PackageManager.PERMISSION_GRANTED -&gt;{
                      // Permission was granted.
                      locationPermission = true
                      fetchLocation()
  
                  }
                      else -&gt; {
                      // Permission denied.
                      Toast.makeText(requireContext(), &quot;Permission Denied&quot;, Toast.LENGTH_SHORT).show();
                  }
              }
          }
      }
  </code></pre>