Hello,
There is no need a big IF statement and two lines of development. But you have to change some places.
You need to set target framework to Android 11 and make sure your minimum Android Version is lower than Android 7 for your project.
After you set the target framework to Android 11, there might be some APIs will be deprecated, you will get some deprecated warnings.
To fix these warnings, you need to use new APIs for android 7 later and keep the old APIs for android 7 or before. You can execute runtime checks for Android versions for different APIs from different android versions.
By the way, with the update of android version, there are some features and limitation. Please read android releases and make sure you know them before you update the android target framework.
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.