enviroCar / enviroCar-app

enviroCar Android Application
https://envirocar.org
GNU General Public License v3.0
89 stars 158 forks source link

Using the new ActivityResults API for handling runtime permission requests #985

Closed devAyushDubey closed 1 year ago

devAyushDubey commented 1 year ago

As mentioned in (mentions #982), the requestPermissions() and onRequestPermissionsResult() APIs are deprecated with androidx fragment version 1.3.0

The new approach is to use ActivityResults API and RequestPermission contract for requesting single permission at a time or RequestMultiplePermissions contract for requesting multiple permission at a time for handling runtime permission requests.

This article also mentions this quite well.

For the microphone request purpose, we have a single permission request to process so I am using RequestPermission contract here.

I see multiple locations where we are using requestPermissions() in the app and other parts of the project. This PR is specific to the feature/voicecommand project.

I would love to implement this upgrade over the entire project in future. Let me know your thoughts.

devAyushDubey commented 1 year ago

Fixed in #992