getFromLocation returns null

Viewed 38

I want to get the current location for android with out using Google APIs Key that's why I'm Using the Geocoder. It is working absolutely for many devices but it not for some selected devices like Latest android version_12 and in OnePlus_v10,11,12.

         if (Geocoder.isPresent())
            {
                try
                {
                    Geocoder geocoder = new Geocoder(contex, Locale.getDefault());
                    List<Address> addresses = geocoder.getFromLocation(latitude, longitude, 1);
                    if (addresses.size() > 0)
                    {
                        cityName = addresses.get(0).getAddressLine(0);
                    }
                }
                catch (Exception e)
                {
                    e.printStackTrace();
                }
            }

Please provide the solution for the same share with someone you know who can fix it.

Also is there any changes in new android device regarding GPS,WI-FI, Network Checker.

0 Answers
Related