mapbox / mapbox/mapbox-plugins-android

Autocomplete results stop showing

Open
#1,008 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

places-plugin
Dominant language
Java
Stars
242
Forks
116
PR merge metrics
No merged PRs in 30d

Description

I'm using the Autocomplete UI component using launchActivityForResult() with the following code:

@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        if (item.getItemId() == R.id.search_button) {

            // Start the autocomplete intent.
            Intent intent = new PlaceAutocomplete.IntentBuilder()
                    .accessToken(Mapbox.getAccessToken())
                    .placeOptions(PlaceOptions.builder()
                            .language(Locale.getDefault().getLanguage())
                            .backgroundColor(Color.parseColor("#EEEEEE"))
                            .build(PlaceOptions.MODE_CARDS))
                    .build(getActivity());
            startActivityForResult(intent, 1);
        }

        return super.onOptionsItemSelected(item);
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == 1) {
            if (resultCode == RESULT_OK) {
                CarmenFeature feature = PlaceAutocomplete.getPlace(data);
                initializeWeatherData(feature.center().latitude(), feature.center().longitude());
            }
        }
    }

When the app is first installed, everything is fine, and it seems to work the first several times, but after a while (or maybe a certain number of searches?) it stops returning any results, either while typing or after clicking the search button. Is this an issue with the API or something I've written? I assume it's in my code, but I don't know how to debug it and view the calls and responses. Gif of behavior is attached below, running on Google Pixel 3XL, Android Q (API 29).

I have tested on multiple Wi-Fi networks, as well as mobile data, with no luck. Once it stops working, it doesn't come back until I uninstall and reinstall the app.

ezgif com-video-to-gif

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure through the PlaceAutocomplete.IntentBuilder flow, including repeated searches until results stop appearing. Inspect the API calls and responses during a working search and after failure, then determine what change prevents results from disappearing until reinstall. Done means autocomplete continues returning results across repeated searches and the behavior is verified on the reported Android setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.