How to update obsoleted classes with newer ones in xamarin.

AndoProgrammer 21 Reputation points
2022-10-25T16:29:03.153+00:00

I am working on a code written with target android version 9 i.e Pie. Now I am trying to update it with target android version 13 but have lots of warning saying about the obsoleted classes. Is there any way to update the old classes or obsoleted classes with the newer ones?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,291 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 35,021 Reputation points Microsoft Vendor
    2022-10-26T03:01:02.957+00:00

    Hello,

    There are no tools or methods to automatically update outdated APIs to the latest APIs.

    You need to update those obsoleted classed or methods manually, please refer to the following Geocoder.GetFromLocation example:

    When you hover over this method, VS will indicate that the method is deprecated and will give you the following link to the native API:

    Java documentation for android.location.Geocoder.getFromLocation(double, double, int).

    Then, when you click this link, you can see the following prompt to use the new API:

    This method was deprecated in API level 33.
    Use getFromLocation(double, double, int, android.location.Geocoder.GeocodeListener) instead to avoid blocking a thread waiting for results.

    Finally, you need to replace the old one with the new API.

    Best Regards,

    Alec Liu.


    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.


0 additional answers

Sort by: Most helpful