Android Place Picker Closes Immediately After Launch

Place Picker Automatically close after launch

After A lot of debugging i solved it myself. The problem was package name..Android studio manage package name by itself on project creation. I change the package name in manifest and it was working perfectly fine. but when i get API key from google developers console for place picker, place picker automatically closes without a single character of error.

Then I change the package name by going into -> Module Settings -> Flavors and change the Application ID and it fix the problem.

Android Place Picker closes immediately after launch

Francois Wouts' solutions helped answer this. Thank you Francois...

I searched the logs with keyword 'Places' and found that Places API was indeed throwing an exception. It expected the com.google.android.geo.API_KEY within the <application> tags in the Manifest.xml.

I had changed to com.google.android.geo.API_KEY in the <activity> tag and not the one in the <application> tag.

Now changed to com.google.android.geo.API_KEY and removed the same lines from <activity> tag, and got it working. Feel like an idiot for not working this out by myself..

The meta-data tag should read android:name="com.google.android.geo.API_KEY"
It should be within the <application> tag in the Manifest.

PlacePicker closes immediatley when launched

Google Places SDK is Depricated, You need to migrate new API "PLACES
API"

Please refer docs..
https://developers.google.com/places/android-sdk/client-migration#place_picker

Place picker automatically closes after launching

This issue will be come if your api key is incorrect or you have not enable the place api over google console.

Google PlacePicker Closes Immediately After Launch

Just enable Google Places API for Android in your Google Developer Console.

Don't forget to specify your API key at AndroidManifest:

<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="ADD_YOUR_API_KEY_HERE" />

Place Picker closes after launching

Was putting meta-data tag wrongly

corrected manifest file :P

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tyagiabhinav.test">

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">

<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="KEY-REMOVED-ON-STACKOVERFLOW" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>

google mapsplace picker close immediately after launch

This place picker is deprecated you need to use new one
use this in your app level gradle
implementation 'com.google.android.libraries.places:places:1.0.0'

 try {
Places.initialize(Objects.requireNonNull(this), "YOUR_KEY");
PlacesClient placesClient = Places.createClient(this);
List<Place.Field> placeFields = Arrays.asList(Place.Field.ADDRESS,
Place.Field.ID,
Place.Field.PHONE_NUMBER,
Place.Field.LAT_LNG);
Intent intent = new Autocomplete.IntentBuilder(
AutocompleteActivityMode.FULLSCREEN, placeFields)
.build(this);
startActivityForResult(intent, PLACE_PICKER_REQUEST);
} catch (Exception e) {
e.printStackTrace();
}

In your activity result

 if (resultCode == RESULT_OK) {
switch (requestCode) {
case PLACE_PICKER_REQUEST:
assert data != null;
Place place = Autocomplete.getPlaceFromIntent(data);
String placeName = Objects.requireNonNull(place.getAddress()).toString();

}
}


Related Topics



Leave a reply



Submit