1

I have the following code in a map activity :

PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment)
            getFragmentManager().findFragmentById(R.id.autocomplete_fragment);


    autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
        @Override
        public void onPlaceSelected(Place place) {
            // TODO: Get info about the selected place.
            destination = place.getName().toString();
        }
        @Override
        public void onError(Status status) {
            // TODO: Handle the error.
        }
    });
}

This is the XML fragment:

        <fragment android:id="@+id/autocomplete_fragment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment"/>

Here is my app build.gradle file :

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.site.test"
    minSdkVersion 15
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-database:16.1.0'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-storage:16.1.0'
implementation 'com.github.bumptech.glide:glide:4.0.0'
//implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.firebase:geofire-android:2.1.1'
implementation 'com.android.support:cardview-v7:21.0.+'
implementation 'com.google.android.gms:play-services-places:16.0.0'
//below added for testing
//implementation 'com.google.android.libraries.places:1.0.0'
`enter code here`}

apply plugin: 'com.google.gms.google-services'

Once the map activity is activated, I see the fragment search box in it's correct placement. Once I click it, the search box pop-up briefly appears then disappears, effectively stopping me from entering a location.

I have enabled the Google Places API, and it is correctly placed in my android manifest file.

This is what the logcat shows :

2019-03-04 00:58:55.090 6506-6506/com.site.test E/SchedPolicy: set_timerslack_ns write failed: Operation not permitted
Mike
  • 11
  • 2

1 Answers1

-1

Seems to be an issue in Places, try this https://stackoverflow.com/a/55073542/11551260