I am facing a problem with Google Place Picker in Android Redmi Phones version 5.1.1. I am using the following code for launching the Google Place Picker.
try {
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
startActivityForResult(builder.build(SelectLocationActivity.this), 1);
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(SelectLocationActivity.this,""+e.getMessage(),Toast.LENGTH_LONG).show();
}
I have added following permissions and api key and google play service version.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="my-api-key" />
</application>
It is working on Every phone except Android Redmi Note2. Any suggestion would be appreciated. Thanks in advance.
Based on your manifest file, I believe that you added the key inside of manifest
tag and not application
. Based on Android docs, the key should be added like this:
<application>
...
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_API_KEY"/>
</application>
Unfortunately, I cannot test it with the device you mentioned, but I remember that I a similar issue with a Samsung
device (the code was working on every device, except that one). Also, check the logs again, maybe there is a message and you missed it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With