Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7788113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:53:26+00:00 2026-06-01T20:53:26+00:00

I am building an android application, and i am using Geocoder to decode the

  • 0

I am building an android application, and i am using Geocoder to decode the location, but i have noticed that sometimes when there is comparatively low connectivity Gecoder does not work. But during the same time, the browser and the rest of the internet based apps function. Is there any way to fix this ? What could possibly be going wrong in this. I do understand that its a back end service but it should not matter.For regular http requests we could give a retry and fix similar issues, but how can i fix this ? Any suggestions?

class ReverseGeocodingTask extends AsyncTask<Double, Void, String> implements OnDismissListener{

    Context context;
    ProgressDialog progDialog;
    String progressString;

    public ReverseGeocodingTask(Context context, String progressStr) {
        this.context = context;
        this.progressString = progressStr;
        if(!isCancelled()){
            initProgDialog();
        }

    }

    void initProgDialog(){

        progDialog = new ProgressDialog(context);
        progDialog.setCanceledOnTouchOutside(false);
        progDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.btn_cancel),new DialogInterface.OnClickListener() {
            public void onClick(final DialogInterface dialog, final int id) {
                progDialog.dismiss();
            }
        });
        progDialog.setMessage(progressString);
        progDialog.setOnDismissListener(this);
        progDialog.show();
    }


    @Override
    protected void onPreExecute() {
        //removeAllPendingRevGeocodingTasks();
        addTask(this);
        super.onPreExecute();
    }

    @Override
    protected String doInBackground(Double... params) {
        String result = null;

        if(!isCancelled()){
            Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault());  
            try {
                List<Address> list = geocoder.getFromLocation(latitude, longitude, 1);

                if (list != null && list.size() > 0) {
                    Address address = list.get(0);
                    result = address.getAddressLine(0) + ", " + address.getLocality();
                }

            } catch (IOException e) {
                progDialog.dismiss();
                failedToUpdateLocation();
                Log.e("Location listener", "Failed to decode location name");
            }
        }
        return result;

    }

    @Override
    protected void onCancelled() {
        progDialog.dismiss();
        this.cancel(true);
        super.onCancelled();
    }

    @Override
    protected void onPostExecute(String result) {
        latLongInDegrees = " "+latLongInDegreesToDMSString(latitude,longitude);
        setLocationName(result);
        updateLocationName(result + latLongInDegrees);

        String progressStr=getString(R.string.msg_slp_fetch_from_geocoder_result_1)+latLongInDegreesToDMSString(latitude,longitude)+"...";
        executeSLPWebserviceTask(latitude, longitude, progressStr);
        finishedUpdatingLocation(latitude,longitude);
        progDialog.dismiss();
        super.onPostExecute(result);
        this.cancel(true);
        //removeAllPendingRevGeocodingTasks();
    }

    public void onDismiss(DialogInterface dialog) {
        this.cancel(true);
    }

}


protected void executeRevGeocoderTask(double lat, double longitude)
{
    String progressStr=getString(R.string.msg_rev_geocoder_fetch)+" "+latLongInDegreesToDMSString(lat,longitude);
    ReverseGeocodingTask task = new ReverseGeocodingTask(this,progressStr);
    task.execute(lat,longitude);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:53:28+00:00Added an answer on June 1, 2026 at 8:53 pm

    Geocoder is a backend service for which we dont have any handle on its http request or anything of that sort. it requires good internet connection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Helo. I am building an application for kids using Phonegap. On Android I have
i am building an android application but i have some questions about the memory
I have an android application in which I take a photo.For that I'm building
I'm building an Android application that's based around an enhanced WebView (based on PhoneGap).
I'm building a little Android game using libgdx. For now I have a copy
HI, I'm building an Android application requiring internet connection, and I'm using ConnectivityManager to
We are building a mobile application that needs to work on both Android and
Many times when I run android application using Eclipse. Eclipse stuck on building the
I am currently building a simple application for Android using the NDK and needs
I'm building the Android scanning app using zxing library. I have built the zxing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.